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

Streams hang when converting fs2 -> zio -> fs2 + map #533

Closed
adamw opened this issue Apr 25, 2022 · 11 comments
Closed

Streams hang when converting fs2 -> zio -> fs2 + map #533

adamw opened this issue Apr 25, 2022 · 11 comments

Comments

@adamw
Copy link

adamw commented Apr 25, 2022

We're debugging hanging websocket tests as part of softwaremill/tapir#2043 (things work fine w/ zio1, stop working when updating to the latest RCs of zio2).

I think I minimised the problem to the following:

import zio.Task
import zio.stream.interop.fs2z._
import zio.interop.catz._

import scala.concurrent.duration.DurationInt

object Test extends App {
  val input: fs2.Stream[Task, String] = fs2.Stream[Task, String]("abc") ++
    fs2.Stream.awakeEvery[Task](1.second).map { _ =>
      println("PRODUCING"); "xyz"
    }

  zio.Runtime.global.unsafeRunToFuture(input.toZStream().toFs2Stream.map(x => x).compile.drain)
}

When this is run, nothing gets printed to the console. Removing .toZStream().toFs2Stream or, interestingly, .map(x => x), causes PRODUCING to be printed out in the expected intervals.

@adamgfraser
Copy link
Contributor

@adamw Hmmm, the above code prints out PRODUCING in the expected intervals when I run it on zio2-interop-ce3.

@adamw
Copy link
Author

adamw commented Apr 25, 2022

Hm what's zio2-interop-ce3? :) I'm using "dev.zio" %% "zio-interop-cats" % "3.3.0-RC5"

@adamw
Copy link
Author

adamw commented Apr 25, 2022

Ah it's a branch name ... let me checkout the project

@adamw
Copy link
Author

adamw commented Apr 25, 2022

@adamgfraser So it indeed works on zio2-interop-ce3 branch, however the fs2 and cats-effect versions are outdated. I tried upgrading to fs2 3.2.7 (from 3.0.6) but the project stopped compiling. Also, cats effect is now at 3.3.11 instead of 3.2.9.

@adamw
Copy link
Author

adamw commented Apr 25, 2022

(my suspicion being that things stop working when using latest fs2/cats-effect :) )

@adamgfraser
Copy link
Contributor

Aren't these versions supposed to be binary compatible?

@adamw
Copy link
Author

adamw commented Apr 25, 2022

@adamgfraser no idea :) apparently at least fs2 is not ;)

@adamgfraser
Copy link
Contributor

Looks like this was broken in fs2 version 3.1.1.

@gavares
Copy link

gavares commented Apr 27, 2022

Is this a bug in fs2 or a bug in this library?

@adamw
Copy link
Author

adamw commented Apr 27, 2022

@adamgfraser Works, thanks a lot for the fix & fast release! :)

@adamgfraser
Copy link
Contributor

@adamw Awesome! 😃

gavares pushed a commit to gavares/zio-metrics that referenced this issue Apr 27, 2022
Ran into a similar issue upgrading Tapir that required a fix to
interop-cats:

- softwaremill/tapir#2043
- zio/interop-cats#533
toxicafunk pushed a commit to zio/zio-metrics-legacy that referenced this issue May 1, 2022
Ran into a similar issue upgrading Tapir that required a fix to
interop-cats:

- softwaremill/tapir#2043
- zio/interop-cats#533

Co-authored-by: ggavares <grant.gavares@oracle.com>
toxicafunk pushed a commit to toxicafunk/zio-metrics that referenced this issue May 1, 2022
Ran into a similar issue upgrading Tapir that required a fix to
interop-cats:

- softwaremill/tapir#2043
- zio/interop-cats#533

Co-authored-by: ggavares <grant.gavares@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants