-
Notifications
You must be signed in to change notification settings - Fork 98
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
Multithreading issues in JRuby? #174
Comments
Looking at your example in stompgem/stomp#142 (comment), if you remove the |
Exactly. Removing the |
The only interesting thing the logging framework is doing with threads is in relation to the diagnostic contexts. The goal of that chunk of code is to capture the diagnostic context from the parent thread when a new thread is spawned. The only way to figure out the parent thread is to capture the information when a new thread is created, so that is why This behavior can be overridden via an environment variable. Would you be willing to run an experiment with your deadlock script and run it with the |
(Un?)Fortunately, I found no difference when running with or without the environment variable.
Other than threading, does logging do any monkeypatching with IO objects? |
Ha Ha Ha Ha! 😂 That made me laugh - thank you 🙇♂️ The sad news here is that the logging framework is not doing any crazy initialization or anything related to sockets or IO. You have to instantiate appenders and loggers before any actions are taken. Here is the list of files required by the logging framework:
One debugging option here is to replace the Is there any output about which thread is deadlocking and where? |
Notes from the stomp gem lead: I cannot recreate a deadlock (or block/hang) using this test code: https://gist.github.com/gmallard/f7c709bc26d5a16b6db6ebeeea20f18a Here is a short test log: https://gist.github.com/gmallard/1641573d0e040ba2dda4328e08e3071a Investigation of the issue reported to me uncovered another bug - but this one will not recreate. For reference: |
Thanks for the debug tips. I was able to replicate a deadlock without any of gem imports, and was later able to replicate the deadlock without |
@mlartz thank you so much for the follow up on this issue. Good luck with the deadlock debugging! 👍 |
I've been having some issues with porting my STOMP consumer to JRuby and am currently getting a deadlock (ref stompgem/stomp#142) when I attemp to
require 'logging'
.The STOMP gem uses a thread to receive STOMP messages via the network over TLS, and I use a thread pool to process/ack that data to the STOMP client. I've pared the offending code down to a very small consumer, which doesn't replicate the issue (although it might have other issues).
That said, when I
require 'logging'
in the stripped down consumer (I use logging in my full application), the demo script deadlocks after it receives/acks a few messages. Unfortunately, I've tried to replicate the issue without the STOMP gem (with just threads/thread pool) but have been unable to. So this issue might pertain to any one of JRuby, JRuby-SSL, STOMP (gem), or logging (gem). Mostly, I'm just wondering if 'logging' does anything tricksy on load that might have an effect on threading/locking/IO/SSL under JRuby?I'm using jruby 9.0.3.0 (2.2.2) 2015-10-21 633c9aa Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
The text was updated successfully, but these errors were encountered: