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

[JRuby 1.7.25] YAML.load_file() fails with IOException after a number of iterations #3851

Closed
nhoughto opened this issue May 4, 2016 · 2 comments

Comments

@nhoughto
Copy link

nhoughto commented May 4, 2016

Hey

Running JRuby 1.7.25 in a JUnit test (not command line), maven dep:

org.jruby
jruby-complete
1.7.25

no special options, environment variables or gems, just stock JRuby. Running on OSX:

Darwin 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

Expected Behavior

Expect the test to complete, running YAML.load_file() of an empty file, 10000 times in a row. The test fails earlier with file content, and earlier depending on the amount of content in the file it seems. The test fails for me around iteration 1200-1800. The unit test to show the failure is attached (RunTests.txt)

Actual Behavior

snakeyml throws an IOException at around ~1200-1800th iteration, not exact everytime obviously. Iteration number depends on the size of the YAML being read in (no content in my test to make it easier). This is all done on one thread, so there shouldn't be any concurrency or thread safety issues i'd think.

org.jruby.embed.EvalFailedException: org.yaml.snakeyaml.error.YAMLException: java.io.IOException at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:138) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1360) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1353) at au.com.nbnco.pos.ib2b.cucumber.RunTests.testYAML(RunTests.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Caused by: org.yaml.snakeyaml.error.YAMLException: java.io.IOException at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:200) at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:60) at org.jruby.ext.psych.PsychParser.readerFor(PsychParser.java:166) at org.jruby.ext.psych.PsychParser.parse(PsychParser.java:178) at org.jruby.ext.psych.PsychParser$INVOKER$i$parse.call(PsychParser$INVOKER$i$parse.gen) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202) at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:116) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:247) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:211) at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:222) at org.jruby.ast.FCallTwoArgBlockNode.interpret(FCallTwoArgBlockNode.java:34) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202) at org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38) at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202) at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206) at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157) at org.jruby.runtime.Block.yield(Block.java:142) at org.jruby.RubyIO.open(RubyIO.java:1201) at org.jruby.RubyIO$INVOKER$s$0$0$open.call(RubyIO$INVOKER$s$0$0$open.gen) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:218) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:211) at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:222) at org.jruby.ast.CallTwoArgBlockNode.interpret(CallTwoArgBlockNode.java:62) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.RootNode.interpret(RootNode.java:129) at org.jruby.evaluator.ASTInterpreter.INTERPRET_ROOT(ASTInterpreter.java:121) at org.jruby.Ruby.runInterpreter(Ruby.java:884) at org.jruby.Ruby.runInterpreter(Ruby.java:892) at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:119) ... 29 more Caused by: java.io.IOException at org.jruby.util.io.ChannelStream$InputStreamAdapter.read(ChannelStream.java:1581) at org.jruby.util.IOInputStream.read(IOInputStream.java:122) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.Reader.read(Reader.java:140) at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:184) ... 81 more

@nhoughto nhoughto changed the title YAML.load_file() failes with IOException after a number of iterations YAML.load_file() fails with IOException after a number of iterations May 4, 2016
@nhoughto nhoughto changed the title YAML.load_file() fails with IOException after a number of iterations [JRuby 1.7.25] YAML.load_file() fails with IOException after a number of iterations May 9, 2016
@enebo enebo added this to the JRuby 9.2.0.0 milestone May 17, 2017
@enebo
Copy link
Member

enebo commented May 17, 2017

I was going to point out you are missing instance.terminate() but that makes this run even shorter than before. I can see by putting JRUBY_OPTS=-d that this script is choking because each time a new innstance is created we explode something for yaml and they just stack up and eventually we hit some resource issue. If terminate is added it get confused by something else...

@headius
Copy link
Member

headius commented May 16, 2018

No easy way to reproduce...I'm not sure what we can do here. Please check if it's still a problem on 9k and reopen if so.

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

No branches or pull requests

4 participants