Skip to content
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

Cannot kill thread with Readline #2841

Closed
e2 opened this issue Apr 16, 2015 · 2 comments
Closed

Cannot kill thread with Readline #2841

e2 opened this issue Apr 16, 2015 · 2 comments

Comments

@e2
Copy link

e2 commented Apr 16, 2015

The following never finishes on JRuby (never gets to the final line):

require 'readline'

th = Thread.new { Readline.readline }
th.join(0.5)

Thread.new do
  sleep 2
  th.kill
end

STDERR.puts "continuing in foreground"
th.join # hangs here

STDERR.puts "Never gets here... ;("

Here are 2 relevant threads from a dump: https://gist.github.com/e2/d58ec0374ce58e7c7495

I don't know if this behavior is intended or not (I just want to quit Readline from a different thread).

@headius
Copy link
Member

headius commented Apr 17, 2015

This is a known issue, and in fact there's another bug about it (at least one): #2383

There's currently no way to do readline non-blocking – a requirement for interrupting it – because we use the jline library. It builds off standard JDK stdio objects, which are not interruptible.

See linked issue for more details.

@headius headius closed this as completed Apr 17, 2015
@headius headius added this to the Invalid or Duplicate milestone Apr 17, 2015
@e2
Copy link
Author

e2 commented Apr 17, 2015

Thanks! I was searching for "blocking" and "io" in the issues and couldn't find it. Didn't expect Readline to be in the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants