简体   繁体   中英

How can I do a thread dump in rubinius?

I want to do a thread dump of my rubinius app to help investigate an apparent deadlock issue. My app is using rbx-3.21, and I'd prefer not to change that if possible.

I've tried doing a pure ruby solution like the one described here , but the thread backtraces don't work properly - they all appear the same as the thread performing the stack dump. The result looks something like this:

Thread-1uvk
common/service.rb:192:in `dump_threads'
  common/service.rb:190:in `dump_threads'
  common/service.rb:90:in `prepare_status'

Thread-1uvs
common/service.rb:192:in `dump_threads'
  common/service.rb:190:in `dump_threads'
  common/service.rb:90:in `prepare_status'

....etc

You should take a look at the Rubinius Book which documents some of the new tools. Specifically, check this out: https://book.rubinius.com/manuscript/inspectability.html

I generally run my code using the example given at the bottom of that page:

rbx -Xsystem.diagnostics.target='./diagnostics-$PID.json' -Xsystem.profiler.target=diagnostics some_script.rb

This will write statistics, including a thread profile, to the json file.

If that isn't enough information, stop on by the Gitter room where many Rubinius users hang out and ask for help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM