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

ZStream: Using timeoutFail logs an unhandled error #8783

Open
jasnross opened this issue Apr 22, 2024 · 4 comments
Open

ZStream: Using timeoutFail logs an unhandled error #8783

jasnross opened this issue Apr 22, 2024 · 4 comments

Comments

@jasnross
Copy link

When I add .timeoutFail to a stream I always get an unhandled error log regardless of whether the stream timed out or not.

The log is at DEBUG level by default, but it seems like it could be misleading to see this if you have debug logs enabled.

Example:

import zio._
import zio.stream._

object StreamTimeoutExample extends ZIOAppDefault {
  override val bootstrap: ZLayer[ZIOAppArgs, Any, Any] =
    Runtime.setUnhandledErrorLogLevel(LogLevel.Info)

  val stream = ZStream
    .iterate(1)(_ + 1)
    .take(5)
    .schedule(Schedule.spaced(100.millis))
    .tap(n => Console.printLine(s"Received: $n"))
    .timeoutFail(new Exception("reached timeout"))(30.seconds)

  override def run = ZIO.logDebug("Start") *> stream.runDrain
}

Expected:

No unhandled error log is emitted since the stream completed successfully

Actual:

timestamp=2024-04-22T19:20:18.607412Z level=INFO thread=#zio-fiber-16 message="Fiber zio-fiber-16 did not handle an error" cause="Exception in thread "zio-fiber-16" scala.None$: None
@jdegoes
Copy link
Member

jdegoes commented May 8, 2024

/bounty $75

Copy link

algora-pbc bot commented May 8, 2024

💎 $75 bounty • ZIO

Steps to solve:

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

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @kpritam May 12, 2024, 6:02:05 PM #8852

@kpritam
Copy link
Contributor

kpritam commented May 12, 2024

/attempt #8783

Algora profile Completed bounties Tech Active attempts Options
@kpritam 1 ZIO bounty
Scala, Makefile,
Python & more
Cancel attempt

Copy link

algora-pbc bot commented May 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants