puma: ARM JRuby - consistent failures

Describe the bug

I thought I’d check if JRuby CI would run on the GitHub Actions arm64 macOS runners. Consistent failures as below:

GHA job: macos-14 jruby

jruby 9.4.8.0 (3.1.4) 2024-07-02 4d41e55a67 OpenJDK 64-Bit Server VM 21.0.4+7-LTS on 21.0.4+7-LTS +jit [arm64-darwin]
SyntaxError: /Users/runner/.rubies/jruby-9.4.8.0/bin/jruby:1: invalid multibyte char (UTF-8)

GHA job: macos-14 jruby-head

jruby 9.4.9.0-SNAPSHOT (3.1.4) 2024-08-12 52b51d5bb8 OpenJDK 64-Bit Server VM 21.0.4+7-LTS on 21.0.4+7-LTS +jit [arm64-darwin]
SyntaxError: /Users/runner/.rubies/jruby-head/bin/jruby:8: syntax error, unexpected local variable or method
if command -v local >/dev/null; then
              ^~~~~

Anyone have any idea what the issue is? Both tests involve restarting Puma.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

A minimal patch to get the restart working correctly for now:

diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb
index 9f0a0a49..afd484c7 100644
--- a/lib/puma/launcher.rb
+++ b/lib/puma/launcher.rb
@@ -287,7 +287,9 @@ module Puma
         close_binder_listeners
 
         require_relative 'jruby_restart'
-        JRubyRestart.chdir_exec(@restart_dir, restart_args)
+        argv = restart_args
+        JRubyRestart.chdir(@restart_dir)
+        Kernel.exec(*argv)
       elsif Puma.windows?
         close_binder_listeners
 

This continues to use the native chdir but then falls back on normal Kernel.exec like the other paths.

The fact that it works on x86_64 does concern me, and it may indicate a bug in FFI handling varargs calls on MacOS aarch64.