You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Signal.signame(9) raises on Windows, though Signal.list["KILL"] is 9 #10080
Temurin 21.0.13, on GitHub's windows-latest runners
Windows Server 2025
Expected Behavior
pSignal.list["KILL"]pSignal.signame(9)
This should print 9 and "KILL", as it does on CRuby on Windows, which defines SIGKILL as 9 and builds Signal.list and Signal.signame from the same table:
Signal.list["KILL"] is 9, but Signal.signame(9) raises:
ArgumentError: invalid signal number: 9
org/jruby/RubySignal.java:211:in 'signame'
I think this goes back to #5430, which made Windows define KILL as 9 even though jnr-constants doesn't define SIGKILL there. It adds KILL to the map of names to numbers that Signal.list reads, but not to the map of numbers to names that Signal.signame reads:
Adding signums.put(9, "KILL") beside signals.put("KILL", 9) should fix it. The other signals jnr-constants defines on Windows (INT, ILL, ABRT, FPE, SEGV and TERM) go into both maps, so I think KILL is the only one affected.
I ran into this in Duel, which names the signal that killed a process with Signal.signame, and now falls back to the signal's number when that raises.
One more difference I found since, which isn't Windows's alone: for a number with no signal, JRuby's Signal.signame raises where CRuby's returns nil. On JRuby 10.1.2.0, on macOS:
$ jruby -e 'p Signal.signame(99)'
ArgumentError: invalid signal number: 99
signame at org/jruby/RubySignal.java:210
<main> at -e:1
$ ruby -e 'p Signal.signame(99)'
nil
CRuby's sig_signame returns nil for a number signo2signm has no name for:
throwargumentError(context, "invalid signal number: " + rubySig);
}
returnnewString(context, signame);
}
So code written for CRuby that checks for nil (to name a signal by its number instead, say) gets an exception on JRuby. Returning nil there would match CRuby, and on Windows, Signal.signame(9) would then return nil rather than raise even before KILL is mapped.
I already merged the signel 9 PR but if you want to fix the additional issue go for it. Behavior should always match CRuby unless we have a really good reason not to.
Activity
sferik commentedon Nov 16, 2026
One more difference I found since, which isn't Windows's alone: for a number with no signal, JRuby's
Signal.signameraises where CRuby's returnsnil. On JRuby 10.1.2.0, on macOS:CRuby's
sig_signamereturnsnilfor a numbersigno2signmhas no name for:https://github.com/ruby/ruby/blob/06b18f11f4b0078e2683c661e7762fff7c04636c/signal.c#L310-L315
JRuby's raises an
ArgumentErrorthere, on every platform (0 aside, which is"EXIT"):jruby/core/src/main/java/org/jruby/RubySignal.java
Lines 204 to 215 in 5378ecb
So code written for CRuby that checks for
nil(to name a signal by its number instead, say) gets an exception on JRuby. Returningnilthere would match CRuby, and on Windows,Signal.signame(9)would then returnnilrather than raise even before KILL is mapped.Map signal 9 to KILL for Signal.signame on Windows
headius commentedon Nov 17, 2026
I already merged the signel 9 PR but if you want to fix the additional issue go for it. Behavior should always match CRuby unless we have a really good reason not to.
headius commentedon Nov 17, 2026
Main issue fixed by #10083. Additional issue moved to #10094.