Cronjobs V2 Sometimes Get Stuck Despite Successfully Executing

a year ago

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?

3 Replies

a year ago

07132e98-0ccf-43b8-aa35-1d32c2fdbcfb


a year ago

Oh just to add I've removed the underlying deploy and tried redeploying on the dashboard.

Now it is just stuck in deploying state


a year ago

Nvm this is solved. There were some hanging Redis connections that isn't closed properly in some of my specific failure cases.


Loading...