Duplicated fibers in fiber dump
See original GitHub issueRunning the following code:
package io.github.timwspence.cats.stm
import cats.effect._
object Test extends IOApp.Simple {
override def run: IO[Unit] =
for {
d <- IO.deferred[Int]
f <- d.get.start
_ <- f.join
_ <- d.complete(1)
} yield ()
}
on JDK 17 and pressing Crtl-T
for a fiber dump yields the following:
cats.effect.IOFiber@707af0cd WAITING
cats.effect.IOFiber@539c7a54 WAITING
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
╰ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
cats.effect.IOFiber@539c7a54 ACTIVE
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
╰ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Thread[io-compute-5,5,run-main-group-1] (#5): 0 enqueued
Thread[io-compute-11,5,run-main-group-1] (#11): 0 enqueued
Thread[io-compute-2,5,run-main-group-1] (#2): 0 enqueued
Thread[io-compute-4,5,run-main-group-1] (#4): 0 enqueued
Thread[io-compute-9,5,run-main-group-1] (#9): 0 enqueued
Thread[io-compute-1,5,run-main-group-1] (#1): 0 enqueued
Thread[io-compute-6,5,run-main-group-1] (#6): 0 enqueued
Thread[io-compute-3,5,run-main-group-1] (#3): 0 enqueued
Thread[io-compute-7,5,run-main-group-1] (#7): 0 enqueued
Thread[io-compute-0,5,run-main-group-1] (#0): 0 enqueued
Thread[io-compute-8,5,run-main-group-1] (#8): 0 enqueued
Thread[io-compute-10,5,run-main-group-1] (#10): 0 enqueued
Global: enqueued 0, foreign 1, waiting 2
Note that fiber 539c7a54
is duplicated as both active and waiting. I’ve re-run it a bunch of times and the output appears to be deterministic
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Allow Fiber.dump to dump all fibers (even from other ... - GitHub
Today (1.0-RC17), Fiber.dump does not print fiber dumps for fibers started from an other unsafeRun. This is extremely problematic in app ...
Read more >Fibers, Oh My!
This idea of fibers yielding to each other is what is known as cooperative scheduling. Fibers effectively move the idea of context switching ......
Read more >Rhabdomyolysis: MedlinePlus Medical Encyclopedia
Rhabdomyolysis is the breakdown of muscle tissue that leads to the release of muscle fiber contents into the blood.
Read more >Fiber Identification Student Guide
BACKGROUND INFORMATION In the world of forensics the identification of a fiber or piece of fabric can provide valuable information for law enforcement ......
Read more >Fiber Dumps · Cats Effect - Typelevel
A fiber dump prints every fiber known to the runtime, regardless of whether they are suspended, blocked, yielding, active on some foreign runtime...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, this is a general problem. I’m pretty sure that
evalOn
ing a fiber which then suspends will lead to the exact same outcome, since it will be registered with both the async callback and the opaque object used forevalOn
registration.See https://github.com/typelevel/cats-effect/pull/2587#discussion_r757802618:
Confirmed with
that
evalOn
introduces the same problem and that the same fix works! 🎉