Cron-Job using node-cron is stopping mid execution
themkrage
PROOP

2 years ago

Hi! I am running like 5-10 cron- jobs in one instance of node-cron being run. I notice that when multiple jobs overlap at the same time, Railway restarts the instance. I looked into resource usage, and nothing passes any set limits for the instance, but there is certainly a spike.

How can I see why Railway restarted my container? I haven't beeen able to answer this in the UI

13 Replies

themkrage
PROOP

2 years ago

98f66160-ce86-4b15-a73b-cab912256208/service/6221097a-1633-425a-b864-85d80f38795d


themkrage
PROOP

2 years ago

here in the middle of the job, without warning, it restarts. the job never completes as a result

1248010898455658800


themkrage
PROOP

2 years ago

there is memory spike around this time, but it never passes the limit, so i wouldnt expect this to be hte reason

1248011099719073800


themkrage
PROOP

2 years ago

and then, 2 minutes after this restart, another job starts. That could also cause this somehow?

How can i reach out to Railway to understand why the job was shut down?


passos
MODERATOR

2 years ago

im 99% sure that your app reached max memory limit and was killed because of that.
the graph might not show but we had problems like that in the past


passos
MODERATOR

2 years ago

but anyway, you're on pro plan, just send them an email


themkrage
PROOP

2 years ago

Good to know. This job is just a bit database write, so im a bit surpirsed we hit the memory limit! I will look into it and see if there's something up. Thanks!


themkrage
PROOP

2 years ago

Good point lol


passos
MODERATOR

2 years ago

well time to use nodejs streams in some way


themkrage
PROOP

2 years ago

im not familiar, whats that?


passos
MODERATOR

2 years ago

stream the data instead of loading its entirety in memory


themkrage
PROOP

2 years ago

oh interesting. havent played around with that. i was just going to decrease the chunk for this write job haha, but that seems like a better solution


passos
MODERATOR

2 years ago

yeah your solution might be better if you just need to do that a few times a day and the data you're feeding doesnt scale


Loading...