Thread dump rust process

How can I get the thread stack trace of a running rust program? With Java I do a kill -QUIT and I can get the thread dump on the console. Thanks in advance.

Native support for backtraces-on-demand is tracked in #53487 or maybe eventually the tracking issue for RFC 3156. If you're on nightly you could try to use the former...

...or in the meanwhile, the current implementation is based on the backtrace crate, so you could use that instead.

Rust doesn't have a runtime per se, so I think you'll have to handle signals yourself if you want that functionality. I imagine you'd have to "manually" poll for a signal flag in choice locations given the limitations of signal handlers (but I didn't look into it in depth).

1 Like

The rstack-self crate provides infrastructure to do a full process thread dump: rstack_self - Rust


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.