Comments (13)
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.
@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.
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.
/bounty $150
from zio-http.
💎 $150 bounty • ZIO
Steps to solve:
- Start working: Comment
/attempt #2902
with your implementation plan - Submit work: Create a pull request including
/claim #2902
in the PR body to claim the bounty - 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 bounty • Share on socials
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟢 @kyri-petrou | Jun 12, 2024, 12:53:01 PM | #2905 |
from zio-http.
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.
@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.
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.
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.
@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.
💡 @kyri-petrou submitted a pull request that claims the bounty. You can visit your bounty board to reward.
from zio-http.
🎉🎈 @kyri-petrou has been awarded $150! 🎈🎊
from zio-http.
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)
- Remove internal usage of warning header HOT 3
- ZClient memory leaks finalizers on each request HOT 8
- Improve ZClient UX with regards to Scope HOT 3
- Simplify `EncoderDecoder` HOT 4
- Improve `Literal` path matching via state machine HOT 5
- Http Server keeps application alive when it should exit HOT 7
- [gen] add support for type aliases (newtype / opaque type) when generating code from spec HOT 5
- HTML Templates can't emit attributes without values HOT 5
- OpenApiGen crashes with stack overflow on recursive case classes
- CRLF stripped in TextFields inside Multipart request HOT 5
- WebSockets don't work with `.enableRequestStreaming` HOT 1
- STM foreach docs confusing HOT 2
- Release final version of ZIO HTTP 3.0 HOT 9
- Remove HttpApp HOT 5
- Multi field case classes as input for query codec HOT 2
- Integrate validation information for query params in generated OpenAPI spec HOT 6
- uuid PathCodec is broken in snapshot versions HOT 6
- Support reason phrase for `Status`
- Handle auth for endpoint without explicit handover HOT 2
- Default `HttpContentCodec` implicit resolution is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zio-http.