Node service crashes on startup and runs out of memory

Last night I got a notification that my app ran out of memory. This is rare since the app has very few users but you never know. This morning I check and it seems the app runs out of memory as soon as it starts. The thing is I haven’t made a change in more than a year. Has infrastructure changed in any way that could cause the application to crash as soon as it starts?

2024-09-03T06:31:09.969 proxy[6e82531fe19468] mad [info] Starting machine
2024-09-03T06:31:10.138 app[6e82531fe19468] mad [info] [ 0.038985] Spectre V2 : WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!
2024-09-03T06:31:10.381 app[6e82531fe19468] mad [info] [ 0.284555] PCI: Fatal: No config space access function found
2024-09-03T06:31:10.621 app[6e82531fe19468] mad [info] INFO Starting init (commit: 20f21dc5f)...
2024-09-03T06:31:10.641 app[6e82531fe19468] mad [info] INFO Preparing to run: `docker-entrypoint.sh yarn run start` as root
2024-09-03T06:31:10.646 app[6e82531fe19468] mad [info] INFO [fly api proxy] listening at /.fly/api
2024-09-03T06:31:10.654 app[6e82531fe19468] mad [info] 2024/09/03 06:31:10 INFO SSH listening listen_address=[fdaa:2:77f0:a7b:51:26ba:2336:2]:22 dns_server=[fdaa::3]:53
2024-09-03T06:31:10.654 runner[6e82531fe19468] mad [info] Machine started in 682ms
2024-09-03T06:31:10.655 proxy[6e82531fe19468] mad [info] machine started in 685.594561ms
2024-09-03T06:31:10.917 app[6e82531fe19468] mad [info] yarn run v1.22.19
2024-09-03T06:31:10.944 app[6e82531fe19468] mad [info] $ nodemon index.ts
2024-09-03T06:31:11.099 app[6e82531fe19468] mad [info] [nodemon] 2.0.19
2024-09-03T06:31:11.099 app[6e82531fe19468] mad [info] [nodemon] to restart at any time, enter `rs`
2024-09-03T06:31:11.100 app[6e82531fe19468] mad [info] [nodemon] watching path(s): *.*
2024-09-03T06:31:11.100 app[6e82531fe19468] mad [info] [nodemon] watching extensions: ts,json
2024-09-03T06:31:11.100 app[6e82531fe19468] mad [info] [nodemon] starting `ts-node index.ts`
2024-09-03T06:31:16.039 proxy[6e82531fe19468] mad [info] waiting for machine to be reachable on 0.0.0.0:3000 (waited 5.38388416s so far)
2024-09-03T06:31:18.836 app[6e82531fe19468] mad [info] [ 8.736611] Out of memory: Killed process 358 (node) total-vm:641692kB, anon-rss:66456kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:732kB oom_score_adj:0
2024-09-03T06:31:18.842 app[6e82531fe19468] mad [info] Killed
2024-09-03T06:31:18.850 app[6e82531fe19468] mad [info] [nodemon] app crashed - waiting for file changes before starting...
2024-09-03T06:31:19.043 proxy[6e82531fe19468] mad [error] [PM05] failed to connect to machine: gave up after 15 attempts (in 8.388500137s)
2024-09-03T06:31:19.071 proxy[6e82531fe19468] mad [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2024-09-03T06:31:29.236 proxy[6e82531fe19468] mad [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2024-09-03T06:31:40.161 proxy[6e82531fe19468] mad [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2024-09-03T06:31:51.075 proxy[6e82531fe19468] mad [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2024-09-03T06:32:01.948 proxy[6e82531fe19468] mad [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2024-09-03T06:34:45.069 app[6e82531fe19468] mad [info] INFO Sending signal SIGINT to main child process w/ PID 318
2024-09-03T06:34:45.892 app[6e82531fe19468] mad [info] INFO Main child exited with signal (with signal 'SIGINT', core dumped? false)
2024-09-03T06:34:45.908 app[6e82531fe19468] mad [info] INFO S[ 215.809161] reboot: Restarting system

I suspect that file is only there to set up swap space. The way we handle swap has changed. If this is true, you can delete that file, delete the ENTRYPOINT line in your Dockerfile, and add one line to your fly.toml:

Note: add this line near the top, before the first line that starts with a [.

Thanks for the reply! I don’t have such a file on my repo nor a line ENTRYPOINT in my docker file ,not sure where that is coming from…

Can I see your Dockerfile?

Are you using nodemon to launch your app :laughing:

I generated a new Dockerfile, since it was quite old.
Among other things I was running the server with nodemon instead of node, and now use node 20.
I seem to have fixed it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.