How can I debug a multi-threaded web application?

We have a requirement for our web server to respond to a callback during the execution of a web request to another server.

Due to Rack::Lock and Rails, the thin web server is reduced to a single thread and therefore the callback is blocked which results in a deadlock.

I've added config.threadsafe! to remove Rack::Lock and changed to the Puma web server which handles multiple threads. This now works when starting the web servers from the console.

However, under the RubyMine debugger it seems to still be reduced to a single thread.

Is there anyway to debug this situation?

Thanks!

3 comments
Comment actions Permalink

Hi,

the debugger itself does nothing about threading.  It just start control thread to communicate with IDE and start the program in another thread.
I'd double-check that the command is correct and that the multi-threaded mode is enabled for the environment which is used during debugging.

Regards, Oleg.

0
Comment actions Permalink

Thanks Oleg.

I'll check. How can I switch between running threads in the debugger?

0
Comment actions Permalink

When application is suspended on a breakpoint you can try to check frame-stack of other thread (combobox just above framestack) (unfortunately this may not work
for ruby 2.0 dues to ruby debugger's limitation :()

Regards, Oleg.

0

Please sign in to leave a comment.