Skip to content

Conversation

@rickychilcott
Copy link
Contributor

@rickychilcott rickychilcott commented Jan 10, 2026

When a worker process is terminated by certain signals (e.g., SIGTERM, SIGKILL), status.exitstatus returns nil, causing a NoMethodError due to operator precedence in the conditional.

This fix:

  1. Adds parentheses to ensure proper evaluation order
  2. Uses .to_i to safely convert nil to 0, preventing the NoMethodError

Fixes the error: NoMethodError: undefined method '>' for nil

When a worker process is terminated by certain signals (e.g., SIGKILL),
status.exitstatus returns nil, causing a NoMethodError due to operator
precedence in the conditional.

This fix:
1. Adds parentheses to ensure proper evaluation order
2. Uses .to_i to safely convert nil to 0, preventing the NoMethodError

Fixes the error: NoMethodError: undefined method '>' for nil
Copy link
Member

@rosa rosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, great catch! I wonder why I've never hit this error 🤔 Sending a SIGKILL to processes is the way I've usually been testing this 😅 Do you know how you triggered it exactly?

@rosa rosa merged commit 73b4dac into rails:main Jan 11, 2026
121 of 128 checks passed
@rickychilcott
Copy link
Contributor Author

Thanks for merging!

Since deploying Solid Queue 1.3.0 I noticed this crop up when I did a deploy on Render. It looks like Render sends a SIGTERM and then sends a SIGKILL after that, if the process isn't running (you can read more at https://render.com/docs/deploys#sequence-of-events).

My guess it that this code was a problem on SIGTERM, but I didn't fully instrument to see which signal was causing the issue.

I was surprised to learn that Process#exitstatus could return nil

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

Successfully merging this pull request may close these issues.

2 participants