Cronjobs V2 Sometimes Get Stuck Despite Successfully Executing
I recently changed some of my services to run using Railway's native cronjobs and I've noticed that in the older version of the Cronjob, it runs semi-reliably, as in sometimes the cronjob would skip and would subsequently skip for every other request.
For the current feature flag of cronjobs, it now get stuck more often than last time. Most of the logs I've seen is
Stopping Container
but they are never finished with Container event container died
, which all subsequent successful containers had.
So I have 2 questions:
- What is the correct way to exit code from the cronjob. From what I can tell, lingering connections (i.e. Redis and Database connections) may never finish the execution of the code, leaving the code hanging.
- I'm using NodeJS, so what I did was to exit the code using a 0 error. I.e. process.exit(0)
. Is this the correct way to exit the code?Solution:Jump to solution
Nvm this is solved. There were some hanging Redis connections that isn't closed properly in some of my specific failure cases.
3 Replies
Project ID:
07132e98-0ccf-43b8-aa35-1d32c2fdbcfb
07132e98-0ccf-43b8-aa35-1d32c2fdbcfb
Oh just to add I've removed the underlying deploy and tried redeploying on the dashboard.
Now it is just stuck in deploying state
Solution
Nvm this is solved. There were some hanging Redis connections that isn't closed properly in some of my specific failure cases.