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

Use the bundler shipped with ruby for non-MRI #2811

Merged
merged 2 commits into from Jan 27, 2022

Conversation

eregon
Copy link
Contributor

@eregon eregon commented Jan 27, 2022

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

Let's make sure CI passes before merging, at this point I think this should work around the issue but not sure yet.

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

At least the compile step worked (https://github.com/puma/puma/runs/4971399375?check_suite_focus=true) unlike https://github.com/puma/puma/runs/4943479989 where it failed before this.

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

Mmh, but 22.0 seems to get a StackOverflow during one test:
https://github.com/puma/puma/runs/4971399375?check_suite_focus=true

So let's pin it to 21.3 for now to fix CI I guess.

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

Oddly enough it passed on macOS: https://github.com/puma/puma/runs/4971399525?check_suite_focus=true
Maybe a transient issue?

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

Ah, the test expects a stack overflow:

def test_lowlevel_error_message
skip_if :windows
@server = Puma::Server.new @app, @events, {:force_shutdown_after => 2}
server_run do
require 'json'
# will raise fatal: machine stack overflow in critical region
obj = {}
obj['cycle'] = obj
::JSON.dump(obj)
end
data = send_http_and_read "GET / HTTP/1.0\r\n\r\n"
assert_match(/HTTP\/1.0 500 Internal Server Error/, data)
assert (data.size > 0), "Expected response message to be not empty"
end

That's extremely brittle for a test, not surprised it's transient.

Seems it was an unlucky run, I'll rerun it:

2022-01-27T19:21:52.4500215Z Caused by: java.lang.NoClassDefFoundError: Ljava/lang/IndexOutOfBoundsException;
2022-01-27T19:21:52.4502607Z 	at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:352)
2022-01-27T19:21:52.4505006Z 	at java.io.FileOutputStream.writeBytes(FileOutputStream.java)
2022-01-27T19:21:52.4507578Z 	at java.io.FileOutputStream.write(FileOutputStream.java:349)

more log:
2022-01-27T19:21:52.4428840Z [ruby] WARNING StackOverflowError
2022-01-27T19:21:52.4442373Z java.lang.RuntimeException: Ruby Thread id=1073 from /home/runner/work/puma/puma/lib/puma/thread_pool.rb:104 terminated with internal error:
2022-01-27T19:21:52.4445103Z 	at org.truffleruby.core.thread.ThreadManager.printInternalError(ThreadManager.java:335)
2022-01-27T19:21:52.4447830Z 	at org.truffleruby.core.thread.ThreadManager.threadMain(ThreadManager.java:323)
2022-01-27T19:21:52.4451119Z 	at org.truffleruby.core.thread.ThreadManager.lambda$initialize$5(ThreadManager.java:291)
2022-01-27T19:21:52.4453571Z 	at java.lang.Thread.run(Thread.java:833)
2022-01-27T19:21:52.4456049Z 	at com.oracle.truffle.polyglot.PolyglotThread.access$001(PolyglotThread.java:51)
2022-01-27T19:21:52.4458558Z 	at com.oracle.truffle.polyglot.PolyglotThread$1.execute(PolyglotThread.java:104)
2022-01-27T19:21:52.4461092Z 	at com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.executeImpl(PolyglotThread.java:134)
2022-01-27T19:21:52.4463656Z 	at com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.execute(PolyglotThread.java:126)
2022-01-27T19:21:52.4466477Z 	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:655)
2022-01-27T19:21:52.4467485Z TestPumaServer#test_lowlevel_error_message = …
2022-01-27T19:21:52.4467901Z TestPumaServer#test_chunked_request_pause_between_chunks = 1.36 s = .
2022-01-27T19:21:52.4472675Z 	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:627)
2022-01-27T19:21:52.4475406Z 	at com.oracle.svm.truffle.api.SubstrateOptimizedCallTargetInstalledCode.doInvoke(SubstrateOptimizedCallTargetInstalledCode.java:174)
2022-01-27T19:21:52.4478865Z 	at com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget.doInvoke(SubstrateOptimizedCallTarget.java:104)
2022-01-27T19:21:52.4481488Z 	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callIndirect(OptimizedCallTarget.java:468)
2022-01-27T19:21:52.4484109Z 	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:449)
2022-01-27T19:21:52.4491711Z 	at com.oracle.truffle.polyglot.PolyglotThread.run(PolyglotThread.java:100)
2022-01-27T19:21:52.4495046Z 	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
2022-01-27T19:21:52.4497690Z 	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)
2022-01-27T19:21:52.4500215Z Caused by: java.lang.NoClassDefFoundError: Ljava/lang/IndexOutOfBoundsException;
2022-01-27T19:21:52.4502607Z 	at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:352)
2022-01-27T19:21:52.4505006Z 	at java.io.FileOutputStream.writeBytes(FileOutputStream.java)
2022-01-27T19:21:52.4507578Z 	at java.io.FileOutputStream.write(FileOutputStream.java:349)
2022-01-27T19:21:52.4509936Z 	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
2022-01-27T19:21:52.4512297Z 	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
2022-01-27T19:21:52.4513963Z 	at java.io.PrintStream.write(PrintStream.java:570)
2022-01-27T19:21:52.4515598Z 	at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)
2022-01-27T19:21:52.4517279Z 	at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:313)
2022-01-27T19:21:52.4519103Z 	at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:111)
2022-01-27T19:21:52.4520833Z 	at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:178)
2022-01-27T19:21:52.4522507Z 	at java.io.PrintStream.write(PrintStream.java:699)
2022-01-27T19:21:52.4524114Z 	at java.io.PrintStream.print(PrintStream.java:863)
2022-01-27T19:21:52.4525932Z 	at org.truffleruby.language.methods.TranslateExceptionNode.translateStackOverflow(TranslateExceptionNode.java:132)
2022-01-27T19:21:52.4527909Z 	at org.truffleruby.language.methods.TranslateExceptionNode.translate(TranslateExceptionNode.java:98)
2022-01-27T19:21:52.4529898Z 	at org.truffleruby.language.methods.TranslateExceptionNodeGen.executeTranslation(TranslateExceptionNodeGen.java:30)
2022-01-27T19:21:52.4531843Z 	at org.truffleruby.language.RubyCoreMethodRootNode.execute(RubyCoreMethodRootNode.java:54)
2022-01-27T19:21:52.4533740Z 	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:655)

@MSP-Greg
Copy link
Member

@eregon Thanks.

So, if I've got this right, Ubuntu truffleruby failed twice, but Ubuntu truffleruby-head and macOS truffleruby (10.15 and 11) all
passed twice.

That's extremely brittle for a test

Debatable. Both Ruby and Puma should be able to gracefully recover from many serious problems. And, yes, that's a PITA sometimes. Not sure what to do, but Puma seems to be a good test for TruffleRuby.

JFYI, what seems like a long time ago, I 'suggested' many repos run Windows CI, and also ruby-head. A lot of bugs showed up in the beginning...

@dentarg
Copy link
Member

dentarg commented Jan 27, 2022

Ah, the test expects a stack overflow:
That's extremely brittle for a test, not surprised it's transient.

Maybe we should skip that test on TruffleRuby?

@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

I adapted the test so it passes reliably on TruffleRuby.

It's indeed some kind of issue in Native Image (GR-36668) that it doesn't produce a normal StackOverflowError, OTOH no VM I know of is safe to use after a stack overflow or an OOM (not the JVM, not CRuby), that might have killled arbitrary cleanup code, e.g. code to unlock a lock, code to clean up a file descriptor or like in this case it might fail at a random place while trying to print something to the console.

@dentarg dentarg merged commit 0a149ec into puma:master Jan 27, 2022
@eregon
Copy link
Contributor Author

eregon commented Jan 27, 2022

Actually I'm thinking to potentially not translate stack-overflow/out-of-memory on TruffleRuby, and just let it terminate the execution and print a clear message. Such errors are so problematic semantically that it might be best to not try running anything after they happen.

@dentarg
Copy link
Member

dentarg commented Jan 27, 2022

Yeah, maybe we don't need to test what we test, in that way. It was added in PR #2607 (a02f924) for #2552 but it wasn't the solution to the problem happening I think.

MSP-Greg pushed a commit to MSP-Greg/puma that referenced this pull request Apr 2, 2022
* Should workaround oracle/truffleruby#2586

* Make the test_lowlevel_error_message test more reliable
MSP-Greg pushed a commit to MSP-Greg/puma that referenced this pull request Apr 3, 2022
* Should workaround oracle/truffleruby#2586

* Make the test_lowlevel_error_message test more reliable
JuanitoFatas pushed a commit to JuanitoFatas/puma that referenced this pull request Sep 9, 2022
* Should workaround oracle/truffleruby#2586

* Make the test_lowlevel_error_message test more reliable
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

Successfully merging this pull request may close these issues.

None yet

3 participants