SYSTEM_ERROR: system encountered unexpected error. Function invocation was interrupted

Viewed 782

I create project on firebase Blaze Plan and I load testing with J Meter with 300 Invocations/Second and I got error from Logs in Cloud Function. What does this error mean?

Very confused. Thanks.

enter image description here

enter image description here

1 Answers

Common function termination reasons are documented here. Note that Firebase Functions is just a wrapper around Google Cloud Functions.

Out of memory

Check for the out of memory logging error line. It should say Function invocation was interrupted. Error: memory limit exceeded. If you're on Node.js v12+, note there are some extra flags that can be set to use large amounts of memory.

Timeouts

Timeouts are another common failure cause, indicated by the log entry Function execution took <XXX> ms, finished with status: 'timeout'

Find the failing invocation logs

Overall, to debug this sort of thing, I'd suggest looking at the logs for the specific function invocation that caused this error. Usually you can do this by adding the labels.execution_id="<my-id>" to the logging query. You can find that value in the fully expanded error log line in the Cloud Logging viewer.

Internal GCF Failure

Sometimes things just don't work out: Function invocation was interrupted. SYSTEM_ERROR: system encountered unexpected error. This happens, rarely. I run millions of invocations a day and see about 3 of these a day. Try adding a retry to your function to handle these cases, if the logic is idempotent.

Finally, if that doesn't work, try escalating to support. Best luck.

Related