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

Add a signal handler for dumping the fiber stack in zio.App #2263

Open
iravid opened this issue Nov 18, 2019 · 6 comments
Open

Add a signal handler for dumping the fiber stack in zio.App #2263

iravid opened this issue Nov 18, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@iravid
Copy link
Member

iravid commented Nov 18, 2019

Using sun.misc.{Signal, SignalHandler}, add a signal hander for SIGUSR1 that dumps the current fiber stack to stderr.

Those classes will work for the JVM, but not for ScalaJS. Something equivalent needs to be found for ScalaJS (and it should only be registered if running under node.js).

The fiber stack can be retrieved using Fiber.dump and Dump#prettyPrintM.

@iravid iravid added good first issue Good for newcomers enhancement New feature or request labels Nov 18, 2019
@adamgfraser
Copy link
Member

Would it be possible to push this into the Runtime and the Platform where we have other options like error reporting and tracing? It would be nice to make this feature easily available to users who aren't extending App.

@iravid
Copy link
Member Author

iravid commented Nov 18, 2019

@adamgfraser The logic, for sure. It's up to the user to make sure it's only done once though.

@pk044
Copy link
Contributor

pk044 commented Nov 18, 2019

I'm up for implementing this 👍

@neko-kai neko-kai added the metrics ZIO Debugging and Monitoring facilities label Nov 28, 2019
@softinio
Copy link
Contributor

softinio commented Dec 1, 2019

@jdegoes is this ticket a duplicate of what I have been working on?

@pk044 you may want to wait to not duplicate effort. It may not be. Adding this to the ZMX project board.

@softinio softinio added this to To do in ZMX via automation Dec 1, 2019
@pk044
Copy link
Contributor

pk044 commented Dec 1, 2019

@softinio no problem 👍

@fanf
Copy link
Contributor

fanf commented Dec 2, 2019

I missed that ticket when opening #2390, thanks @ghostdogpr for noticing!

So my use case is (obviously) to allow debugging unforseen lock in production, especially if the lock happens in a condition set hard to diagnose and reproduce.

Moreover, the listener for that signal might need to live in its own thread/fiber pool so that we can analyse even situation where zio-default-async is exhausted like in #2373.

And it needs to be available for user which don't use App (my use case: porting an historical app to zio, with lots of call to unsafeRun for bridges, and so lots of chances to deadlock everything)

@softinio softinio assigned softinio and unassigned softinio Dec 8, 2019
@softinio softinio self-assigned this Dec 28, 2019
@softinio softinio removed the metrics ZIO Debugging and Monitoring facilities label Mar 1, 2020
@softinio softinio removed this from To do in ZMX Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants