-
Notifications
You must be signed in to change notification settings - Fork 16
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
image built from pack fails to run due to "worker mode not supported on jruby on this platform" #27
Comments
Thank you for reporting this issue. I don't know the root cause but will share some information
This error is coming from puma, the default webserver for Rails ( This is because JRuby uses the JVM and the java virtual machine does not support forking processes https://jukkaz.wordpress.com/2010/05/27/forking-a-jvm/ "Unfortunately Java doesn't support the concept of a fork (i.e. creating a copy of a running process)." I couldn't find a better quote explaining why, but what I've been told is that it's because the JVM targets many operating systems and not all of them support forking processes, notably windows (IIRC). For reference I talk a bit about differences between processes and threads here https://www.schneems.com/2017/10/23/wtf-is-a-thread/. Puma is a "hybrid" webserver meaning it can run multi process or multi threaded or a combination of multiple processes with multiple threads. So what's happening is that somehow there's config that's telling puma to boot multiple processes (known as "workers" in puma) and then that fails because JRuby doesn't support that feature. Detour: Why processes and threads? Like python, Ruby has a global interpreter lock (GIL) or global VM lock GVL or acronym variation. This protects internal state because C is not inherently threadsafe ( Notably, JRuby doesn't have a GIL because it's source code is written in JVM bytecode which is threadsafe. That means it doesn't need processes in quite the same way that ruby/ruby needs processes. As a personal note processes are incredibly useful beyond this limitation, but that's not important. The question is: Where is the config coming from that would cause puma to try to fork a process? It could be coming from our own config https://github.com/heroku/jruby-getting-started/blob/c5899119fea3270b9aa5fcff6d4abb3c60d522b3/config/puma.rb or it could be coming from the integration with |
As a note it works on the classic platform. On the classic platform it uses the
Here's how to get it to fail on Heroku classic (but with a different error message)
|
After building an image with
pack
using the heroku-24 builder, the image cannot be ran because of worker mode being unsupported.Image generated from
pack build jruby-app --builder heroku/builder:24
The text was updated successfully, but these errors were encountered: