Google App Engine NodeJS app stops after 30 min

Viewed 310

I have a very basic NodeJS application hosted on Google App Engine that executes an async function on 15 second intervals. The deployment is successful and the app starts and runs fine, but stops after about 30 minutes with the following error logs. This runs fine locally, though.

Quitting on terminated signal

Start program failed: user application failed with exit code -1 (refer to stdout/stderr logs for more detail): signal: terminated

I have used App Engine before with no issues, so I'm not sure why this is happening. I used https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/appengine/typescript as a reference and am still not able to resolve this issue. Any ideas?

1 Answers

Quitting on terminated signal

You may receive this error if your App Engine instances is down scaling or shutting down due to some reasons and possibly due to:

  1. Your application runs out of Instance Hours quota.
  2. Your instance is moved to a different machine, either because the current machine that is running the instance is restarted, or App Engine moved your instance to improve load distribution.

There are good strategies to avoid the downtime of your instance and here are additional:

  1. You can try to have a minimum number of idle instances

  2. Use manual scaling which you can specify the number of instances will continuously run regardless of the load level.

  3. Increase the maximum instance.

Asynchronous background work is not recommended in App Engine. It can result in higher billing and users may also experience increased latency because of high pushback or request queuing. Google recommend to use Cloud Tasks. With Cloud Tasks, HTTP requests are long-lived and return a response only after any asynchronous work ends.

Related