Issue Type: Bug Bug
Affects Versions: JRuby 1.7.3
Assignee: Thomas E Enebo
Created: 04/Apr/13 7:50 AM
Description:

Kernel.sleep swallows InterruptedException, which means that it doesn't play well with, for example, ExecutorService#shutdown_now.

I've written two test cases that demonstrate the issue:

https://github.com/iconara/jruby/compare/sleep_interrupt_test

The tests show how sleep ignores interrupts. When the thread that is sleeping is interrupted they should either rethrow the InterruptedException or at least unblock and set the interrupt flag, but both of them instead sleeps until as long as they would have had there been no interrupt. If you change sleep to java.lang.Thread.sleep they would both succeed.

I would have liked to be able to give you a complete patch for this, the fix should be simple: just don't swallow the exception, but the compiler won't allow me to declare sleep to throw InterruptedException, I'm not sure what's going on, I don't know enough about the JRuby code base to do it unfortunately.

It looks like it's been like this forever (I've traced the code back to a commit 11 years ago...), and maybe there's a lot of code out there that could potentially break if sleep was changed to be more Java friendly.

Project: JRuby
Priority: Major Major
Reporter: Theo Hultberg
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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

Reply via email to