IO.popen("ruby") hangs
----------------------
Key: JRUBY-1626
URL: http://jira.codehaus.org/browse/JRUBY-1626
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: Ubuntu Linux 7.10,
JRuby 1.1b1
Reporter: Vladimir Sizikov
Priority: Critical
IO.popen("ruby") just hangs with JRuby.
In fact, instead of "ruby" there could be ANY string with "ruby" as substring.
:)
Seems like JRuby ShellLauncher.run() method has a very hackish way to decide
whether to run in-process or in-shell, and when the supplied string is executed
"in-process", attempt to open process stream just hangs.
Here are some stack traces relevant to this problem:
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x7a592098> (a java.io.PipedInputStream)
at java.io.PipedInputStream.read(PipedInputStream.java:310)
- locked <0x7a592098> (a java.io.PipedInputStream)
at org.jruby.util.IOHandlerProcess.sysread(IOHandlerProcess.java:176)
at org.jruby.util.IOHandlerJavaIO.read(IOHandlerJavaIO.java:120)
at org.jruby.util.IOHandlerJavaIO.gets(IOHandlerJavaIO.java:61)
at org.jruby.RubyIO.internalGets(RubyIO.java:487)
at org.jruby.RubyIO.internalGets(RubyIO.java:480)
at org.jruby.RubyIO.gets(RubyIO.java:982)
at org.jruby.RubyIOInvoker$gets_method_0_1.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
And when executed via jruby -e ...:
"ScriptThreadProcess: piped" prio=10 tid=0x08372c00 nid=0x854 runnable
[0xb50fc000..0xb50fd140]
java.lang.Thread.State: RUNNABLE
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.read(BufferedInputStream.java:237)
- locked <0x7a3bb138> (a java.io.BufferedInputStream)
at
org.jruby.lexer.yacc.InputStreamLexerSource.wrappedRead(InputStreamLexerSource.java:114)
at
org.jruby.lexer.yacc.InputStreamLexerSource.read(InputStreamLexerSource.java:53)
at org.jruby.lexer.yacc.RubyYaccLexer.yylex(RubyYaccLexer.java:714)
at org.jruby.lexer.yacc.RubyYaccLexer.advance(RubyYaccLexer.java:238)
at
org.jruby.parser.DefaultRubyParser.yyparse(DefaultRubyParser.java:883)
at
org.jruby.parser.DefaultRubyParser.yyparse(DefaultRubyParser.java:835)
at org.jruby.parser.DefaultRubyParser.parse(DefaultRubyParser.java:3302)
at org.jruby.parser.Parser.parse(Parser.java:168)
at org.jruby.Ruby.parseFile(Ruby.java:1590)
at org.jruby.Ruby.runFromMain(Ruby.java:422)
at org.jruby.Main.runInterpreter(Main.java:229)
at org.jruby.Main.runInterpreter(Main.java:185)
at org.jruby.Main.run(Main.java:116)
at org.jruby.Main.run(Main.java:93)
at
org.jruby.util.ShellLauncher$ScriptThreadProcess.run(ShellLauncher.java:80)
at java.lang.Thread.run(Thread.java:619)
Please note that Rubinius spec tests use IO.popen in some tests, and that means
that the test execution is effectively halts in those places. It would be
really good to fix this up.
--
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