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

Crash when using puma forking #88

Open
bmulholland opened this issue May 6, 2022 · 3 comments
Open

Crash when using puma forking #88

bmulholland opened this issue May 6, 2022 · 3 comments

Comments

@bmulholland
Copy link

I posted a repro here: https://github.com/bmulholland/rjb-fork-crash

Short version is that, when trying to use puma workers, Rjb.load crashes. Output is:

objc[10802]: +[NSMethodSignature initialize] may have been in progress in another thread when fork() was called.
objc[10802]: +[NSMethodSignature initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
@arton
Copy link
Owner

arton commented May 7, 2022

Hi bmulholland
I couldn't reproduce it on my X64 Linux. I suppose it causes JVM implementation for ARM. Any other Java application runs fine ?
By the way, thank you for giving me the reproducable project. It' very helpful (sorry not for this case).

@bmulholland
Copy link
Author

We have reproduced this crash (or at least, one very similar) on an Intel Mac as well. A workaround for us is to run the Rjb.load on every HTTP request, inside the worker. That workaround runs on all our machines, so there's no problem with JVM or anything. We do, however, need to use OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES for it to work, which seems dangerous, but at least it's only necessary on our development machines.

@MatheusRich
Copy link

To add to @bmulholland 's comment, here's the configuration added to puma.rb:

before_fork do
  Rjb.load # Remove all the Rjb.load calls in the app
end

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

3 participants