RubyThread deadlock detection ----------------------------- Key: JRUBY-4682 URL: http://jira.codehaus.org/browse/JRUBY-4682 Project: JRuby Issue Type: Improvement Components: Core Classes/Modules Affects Versions: JRuby 1.4 Environment: jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-03-29 665841c) (Java HotSpot(TM) Client VM 1.6.0_16) [i386-java]
Reporter: Hiroshi Nakamura Attachments: 0001-Tweak-Thread-inspect-format.patch, 0002-Tweak-thread-tried-to-join-itself-excn-message.patch, 0003-RubyThread-deadlock-detection.patch 0003-RubyThread-deadlock-detection.patch is a patch for trying deadlock detection. * detect mutual join deadlock as well as CRuby 1.8 * detect a deadlock by joining a Thread after Thread.critical = true. * TODO * cannot detect a deadlock by joining thread which is Thread.critical = true. * cannot detect a deadlock by no schedulable thread. % ruby -ve 'Thread.new { Thread.new { Thread.main.join }.join }.join' ruby 1.8.8dev (2010-03-30 revision 27031) [i686-linux] deadlock 0xb78a5a54: sleep:J(0xb78b3f8c) - -e:1 deadlock 0xb78b3f8c: sleep:J(0xb78a5acc) (main) - -e:1 deadlock 0xb78a5acc: sleep:J(0xb78a5a54) - -e:1 -e:1: Thread(0xb78a5acc): deadlock (fatal) % ruby19 -ve 'Thread.new { Thread.new { Thread.main.join }.join }.join' ruby 1.9.2dev (2010-03-29 trunk 27083) [i686-linux] -e:1:in `join': deadlock detected (fatal) from -e:1:in `<main>' % /home/nahi/git/jruby-master/bin/jruby -ve 'Thread.new { Thread.new { % Thread.main.join }.join }.join' jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-03-29 665841c) (Java HotSpot(TM) Client VM 1.6.0_16) [i386-java] [sleeps forever] CAUTION: This patch removes following part of the Thread#join in current code. I don't understand what this code is doing. I should be missing something. {noformat} if (threadService.getCritical()) { // If the target thread is sleeping or stopped, wake it synchronized (this) { notify(); } ... {noformat} Peer review needed. And, 0001 and 0002 patches are cosmetic tweaks for Thread. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email