-
Notifications
You must be signed in to change notification settings - Fork 522
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
Add IORuntime#liveFiberSnapshot
#3038
base: series/3.x
Are you sure you want to change the base?
Conversation
def liveFiberSnapshot(): Unit = liveFiberSnapshot(System.err.println(_)) | ||
def liveFiberSnapshot(print: String => Unit): Unit = | ||
fiberMonitor.liveFiberSnapshot(print) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should expose a method that returns a String
(collection)? Something that can be called from the IDE/debugger easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm not sure how useful that is. I guess a test framework would call this method during its timeout hook on a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't want to expose this here, we could make it a method in the testkit
package. Then only test frameworks could use it.
So I think that rolling it up in this way is probably unhelpful. I think what we want is something isomorphic to this: final class IORuntime(...) {
// ...
/**
* We should have a warning here about memory leaks, since it contains hard references to Fiber(s)
*/
def snapshot(): List[FiberInfo] = ???
def metrics(): IORuntimeMetrics = ???
}
final case class IORuntimeMetrics(enqueued: Int, foreign: Int, waiting: Int, workers: List[IORuntimeWorkerMetrics])
final case class IORuntimeWorkerMetrics(index: Int, enqueued: Int)
final case class FiberInfo(fiber: Fiber[IO, _], state: FiberState, trace: FiberTrace)
sealed class FiberState(override val toString: String) extends Product with Serializable
object FiberState {
case object Running extends FiberState("RUNNING")
case object Blocked extends FiberState("BLOCKED")
case object Yielding extends FiberState("YIELDING")
case object Waiting extends FiberState("WAITING")
case object Active extends FiberState("ACTIVE")
}
final case class FiberTrace(frames: List[StackTraceElement]) {
def pretty: String = ???
} We should gather the I believe the above should be sufficient for any external framework to implement the type of semantic they want. It's still an open question of what form that integration should take, but it's more of a problem for munit/specs/etc. |
This reverts commit 5e17ca8.
Co-authored-by: Daniel Spiewak <[email protected]>
Co-authored-by: Daniel Spiewak <[email protected]>
What work remains on this? Is there a clear spot where someone can come in and help? |
I think I've copied Daniel's proposed data structures into the PR. If I haven't yet, that's the first step. Then, all existing fiber dump machinery should be migrated to those data structures. Currently it is just string manipulation.
Yep, someone can take over the PR (or start from scratch) proceeding with the above. I would appreciate it!! |
Starting from the obvious 😂
Fixes #2580. Fixes #3025.