Repository navigation
Fix NoMethodError when status.exitstatus is nil - #700
Conversation
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
rosa
left a comment
There was a problem hiding this comment.
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?
|
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 |
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:
Fixes the error: NoMethodError: undefined method '>' for nil