OS X does not restart reads after SIGTSTP
-----------------------------------------
Key: JRUBY-3384
URL: http://jira.codehaus.org/browse/JRUBY-3384
Project: JRuby
Issue Type: Bug
Components: IBM/Other VM
Affects Versions: JRuby 1.1.6
Reporter: Charles Oliver Nutter
Assignee: Charles Oliver Nutter
I discovered this while working on JRUBY-2988 and then found a hack in Scala's
codebase to work around the fact that OS X does not restart reads after a
SIGTSTP (process suspension).
Here's a link to the Scala code:
http://lampsvn.epfl.ch/trac/scala/browser/scala/branches/virtual-traits/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala?rev=16291#L33
The way they handle it is by checking for an IOException of a particular
message ("Interrupted system call") and simply trying the read again. I am
making that modification in two places that directly affect the ability to
suspend jirb, but this seems like a general problem that needs a more general
solution.
Here's an example of the trace that results:
{noformat}
$ jirb --noreadline
irb(main):001:0> puts 1
1
=> nil
irb(main):002:0> ^Z
[1]+ Stopped jirb --noreadline
[headius @ cnutter:~/projects/jruby]
$ fg
jirb --noreadline
java.io.IOException: Interrupted system call
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:199)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at
java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:200)
at org.jruby.util.io.ChannelStream.refillBuffer(ChannelStream.java:189)
at org.jruby.util.io.ChannelStream.getline(ChannelStream.java:316)
at org.jruby.RubyIO.getlineFast(RubyIO.java:747)
at org.jruby.RubyIO.getline(RubyIO.java:625)
at org.jruby.RubyIO.gets(RubyIO.java:1820)
{noformat}
--
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