Skip to content

App + cats-effect hangs on 3.1.0 but works fine in 2.13.7 #1326

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

Closed
jmgimeno opened this issue Jan 12, 2022 · 1 comment
Closed

App + cats-effect hangs on 3.1.0 but works fine in 2.13.7 #1326

jmgimeno opened this issue Jan 12, 2022 · 1 comment

Comments

@jmgimeno
Copy link

This code

import cats.effect._
import cats.implicits._
import cats.effect.unsafe.implicits.global

object IOComposition extends App {
  val hello = IO(println(s"[${Thread.currentThread.getName}] Hello"))
  val world = IO(println(s"[${Thread.currentThread.getName}] World"))
  val hw1: IO[Unit] = for {
    _ <- hello
    _ <- world
  } yield ()
  val hw2: IO[Unit] =
    (hello, world).mapN((_, _) => ())
  hw1.unsafeRunSync()
  hw2.unsafeRunSync()
}

hangs with Scala 3.1.0 after printing only "Hello"

Compiling project (Scala 3.1.0, JVM)
Compiled project (Scala 3.1.0, JVM)
[io-compute-2] Hello

but works perfecty with Scala 2.13.7

Compiling project (Scala 2.13.7, JVM)
Compiled project (Scala 2.13.7, JVM)
[io-compute-2] Hello
[io-compute-4] World

Also opened in cats-effect as typelevel/cats-effect#2748

@SethTisue
Copy link
Member

SethTisue commented Jan 12, 2022

This is the issue tracker of the Scala website, not of the Scala language. If you want to report a bug in Scala 3, that's https://github.com/lampepfl/dotty/issues

But actually, I think you should hold off on opening a ticket there. You should wait until you or the cats-effect folks have solid evidence that a bug in Scala itself is actually the root cause of the hang you are experiencing.

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

2 participants