Skip to content

Signal.signame(9) raises on Windows, though Signal.list["KILL"] is 9 #10095

Open

Description

@headius

Clone of #10080 for 10.1.

Environment Information

  • JRuby 10.1.3.0
  • Temurin 21.0.13, on GitHub's windows-latest runners
  • Windows Server 2025

Expected Behavior

p Signal.list["KILL"]
p Signal.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:

https://github.com/ruby/ruby/blob/06b18f11f4b0078e2683c661e7762fff7c04636c/include/ruby/win32.h#L425-L427

Actual Behavior

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:

// We always define KILL as 9 on Windows
if (Platform.IS_WINDOWS) {
signals.put("KILL", 9);
}

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.

Activity

  1. added this to the JRuby 10.1.4.0 milestone on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions