Better Ruby stack trace from a Java stack trace?

Hi all!

We are investigating a blocked thread in a Ruboto app. The app is
running on the Dalvik VM, but I expect most things to be as on the JVM.

We want to know where in the Ruby code the app is blocking.

We have tried inserting “puts” statements all over the code, but it
takes a very long time to debug that way, especially since the path of
the program varies on each trial.

We have also used

puts
java.lang.Thread.getAllStackTraces().get(blocking_thread).map(&:to_s).join("\n")

to display the stack trace for the blocked thread. The result is here:

https://gist.github.com/donv/5212722

Is there a way to get more information from the stack trace? What Ruby
code is involved?


Uwe K.
Systems Developer
Datek Wireless AS
[email protected]
http://datek.no/

On 2013-03-21, at 13:40, Uwe K. [email protected] wrote:

We are investigating a blocked thread in a Ruboto app. The app is running on
the Dalvik VM, but I expect most things to be as on the JVM.

We want to know where in the Ruby code the app is blocking.

puts
java.lang.Thread.getAllStackTraces().get(blocking_thread).map(&:to_s).join("\n")

https://gist.github.com/donv/5212722

Is there a way to get more information from the stack trace? What Ruby code is
involved?

Delved into the JRuby source and found this way:

org.jruby.Ruby.getGlobalRuntime.thread_service.ruby_thread_map.get(t).backtrace.join("\n")

Here is the result:

https://gist.github.com/donv/5212722#file-org-jruby-ruby-getglobalruntime-thread_service-ruby_thread_map-get-t-backtrace-join-n

This gives a good hint, but the full stack trace is missing. Only the
10 last frames are shown. To make the dump really useful, all the stack
frames should be dumped. Also, the most recent method call to
Mutex.lock which is shown in the Java stack trace is missing from the
Ruby stack trace.

Any help is appreciated.


Uwe K.
[email protected]
http://kubosch.no/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs