Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout doesn't cancel correctly the HTTP client call #2848

Closed
lmlynik opened this issue May 16, 2024 · 5 comments · Fixed by #2889
Closed

timeout doesn't cancel correctly the HTTP client call #2848

lmlynik opened this issue May 16, 2024 · 5 comments · Fixed by #2889
Labels
💎 Bounty bug Something isn't working 💰 Rewarded

Comments

@lmlynik
Copy link

lmlynik commented May 16, 2024

Describe the bug
Certain sites which take long to respond cause that timeout doesn't cancel correctly.

test.com is such example

To Reproduce

//> using scala "2.13.10"
//> using lib "dev.zio::zio:2.1.1"
//> using lib "dev.zio::zio-http:3.0.0-RC6"

import zio._
import zio.http._

object Main extends ZIOAppDefault {
  val url = URL.decode("https://test.com").toOption.get

  val program = for {
    _ <- ZIO.log("Starting program")
    res <- ZClient.request(Request.get(url)).timeoutFail("Timeout")(1.seconds)
    data <- res.body.asString
    _ <- ZIO.log(data)
  } yield ()

  val run =
    program.catchAll(er => ZIO.logError(er)).provide(
      Client.default,
      Scope.default,
    )
}
timestamp=2024-05-16T17:32:47.171758467Z level=INFO thread=#zio-fiber-4 message="Starting program" location=<empty>.Main.program file=Main.scala line=10
timestamp=2024-05-16T17:33:47.551636313Z level=ERROR thread=#zio-fiber-4 message="Timeout" location=<empty>.Main.run file=Main.scala line=16

Expected behaviour
The Timeout error should come in after a 1 second, not 1 minute

@lmlynik lmlynik added the bug Something isn't working label May 16, 2024
@lmlynik
Copy link
Author

lmlynik commented May 16, 2024

Also the minute, the app doesn't terminates

@jdegoes
Copy link
Member

jdegoes commented Jun 4, 2024

/bounty $100

Copy link

algora-pbc bot commented Jun 4, 2024

💎 $100 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2848 with your implementation plan
  2. Submit work: Create a pull request including /claim #2848 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 #2889

Copy link

algora-pbc bot commented Jun 6, 2024

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

Copy link

algora-pbc bot commented Jun 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty bug Something isn't working 💰 Rewarded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants