Coder Social home page Coder Social logo

Comments (13)

gaeljw avatar gaeljw commented on August 17, 2024 1

I confirm that even with a delay of 5 seconds, I do see errors with roughly the same apparition rate. There's something else.

from zio-http.

kyri-petrou avatar kyri-petrou commented on August 17, 2024 1

@gaeljw I think I found the source of your issue but at the moment I have no idea why it's happening (something to do with the DnsResolver).

As a workaround, define the URL like this in your test suite:

val url = s"http://0.0.0.0:${mockServer.getPort}"

One more thing, I see that you're overriding the netty version with something much much older than what zio-http is meant to be using. I would highly recommend if you have multiple dependencies using netty to use the zio-http-shaded package instead in order to avoid netty version conflicts

from zio-http.

gaeljw avatar gaeljw commented on August 17, 2024

To be fair, this might be just highlighting an issue in another library than zio-http (pact4s maybe which is the main other library used in the tests).

I have no clue as how to investigate the issue though, any help appreciated.

from zio-http.

jdegoes avatar jdegoes commented on August 17, 2024

/bounty $150

from zio-http.

algora-pbc avatar algora-pbc commented on August 17, 2024

💎 $150 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2902 with your implementation plan
  2. Submit work: Create a pull request including /claim #2902 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @kyri-petrou Jun 12, 2024, 12:53:01 PM #2905

from zio-http.

kyri-petrou avatar kyri-petrou commented on August 17, 2024

I have no clue as how to investigate the issue though, any help appreciated.

@gaeljw what about adding a small delay to the request, to ensure that the mocked server has finalized booting? You can do that by adding .delay(500.millis) or so here

from zio-http.

gaeljw avatar gaeljw commented on August 17, 2024

@kyri-petrou I already tried to add delay without success (not this way though, will try in doubt): the error still appears. I believe there's something else going on.

The server is supposed to be already available, the ScalaTest trait enforce it: https://github.com/jbwheatley/pact4s/blob/99a987da173d904f79486621a6ac7a3b0aeaffa4/scalatest-pact/src/main/scala/pact4s/scalatest/RequestResponsePactForger.scala#L38

Note that I also tried to write it as a ZIO Test and same results.

from zio-http.

kyri-petrou avatar kyri-petrou commented on August 17, 2024

Thanks, I'll look into it
/attempt #2902

Algora profile Completed bounties Tech Active attempts Options
@kyri-petrou 15 ZIO bounties
Scala, Python,
Shell & more
Cancel attempt

from zio-http.

Not-Aru avatar Not-Aru commented on August 17, 2024

We are experiencing a similar issue when using ConnectionPoolConfig.Dynamic. We started experiencing this when upgrading from RC6 to RC8. We have created a minimized reproducer here:

object Reproducer extends ZIOAppDefault {
  private val clientLayer =
    (ZLayer.succeed(Config.default.copy(connectionPool = ConnectionPoolConfig.Dynamic(1, 512, 60.second))) ++ ZLayer
      .succeed(NettyConfig.defaultWithFastShutdown) ++
      DnsResolver.default) >>> Client.live

  private val url = URL.decode("http://0.0.0.0:8080/Test").toOption.get
  private val req = Request.post(url, Body.empty)

  private val routes =
    HttpApp(
      Routes(
        Method.POST / "Test" ->
          handler(Response.text("success"))
      )
    )

  val run: ZIO[Any with ZIOAppArgs with Scope, Throwable, Unit] = {
    for {
      _ <- Server.serve(routes).fork
      client <- ZIO.service[Client]
      _ <- ZIO.foreachParDiscard(0 to 400) { _ =>
        ZIO
          .scoped[Any] {
            client.request(req).flatMap(_.body.asArray)
          }
          .repeatN(100)
      }
    } yield ()
  }.provide(clientLayer, Server.default)
}

from zio-http.

kyri-petrou avatar kyri-petrou commented on August 17, 2024

@Not-Aru I believe that's a separate issue. In fact, I think it might be resolved in the latest main branch. I managed to run your code without any issues, although i had to limit parallelism as it was opening too many connections to the server and netty started rejecting them.

Can you check whether the non-minimized issue you're facing is resolved in the latest snapshot? 3.0.0-RC8+22-5ea81ef6-SNAPSHOT

from zio-http.

algora-pbc avatar algora-pbc commented on August 17, 2024

💡 @kyri-petrou submitted a pull request that claims the bounty. You can visit your bounty board to reward.

from zio-http.

algora-pbc avatar algora-pbc commented on August 17, 2024

🎉🎈 @kyri-petrou has been awarded $150! 🎈🎊

from zio-http.

gaeljw avatar gaeljw commented on August 17, 2024

Wow, nice finding @kyri-petrou. Thanks for the work!

I would highly recommend if you have multiple dependencies using netty to use the zio-http-shaded package instead in order to avoid netty version conflicts.

Nice, I didn't know about this one. I will check if there's a good reason to have a such old Netty version in my real project :)

from zio-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.