Cron-Job using node-cron is stopping mid execution

themkragePRO

a year 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

0 Replies

themkragePRO

a year ago

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


themkragePRO

a year ago

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

1248010898455658800


themkragePRO

a year ago

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

1248011099719073800


themkragePRO

a year 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?


a year 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


a year ago

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


themkragePRO

a year 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!


themkragePRO

a year ago

Good point lol


a year ago

well time to use nodejs streams in some way


themkragePRO

a year ago

im not familiar, whats that?


a year ago

stream the data instead of loading its entirety in memory


themkragePRO

a year 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


a year 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