# "Service Unavailable" crashing the container

**URL:** <https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [February 25, 2020, 12:48pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858 "2020-02-25T12:48:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Petrie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_petrie/32/59145_2.png) [@Matthew\_Petrie](https://discuss.elastic.co/u/Matthew_Petrie)\
**Post date:** [February 25, 2020, 12:48pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858/1 "2020-02-25T12:48:43Z")

</div>

**Kibana version** : 7.6  
**Elasticsearch version** : 7.6  
**APM Server version** : 7.6  
**APM Agent language and version** : Node.JS 3.3.0  
**Original install method** : Elastic Cloud

**Other:**

- Code running on Google Cloud Run (Knative container based serverless offering)
- We have noticed this issue arrise when our Elastic cluster is under particularly high load

Sporadically we receive the following error in our logs which ends with exiting the process i.e. crashing the container. I would expect the below to not crash the container so it can carry on handling requests / doesn't cause a request to stop:

```auto
APM Server transport error (503): Unexpected APM Server response when polling config

```

```auto
{
  error: "Service Unavailable"   
  message: "Service Unavailable"   
  statusCode: 503   
 }

```

```auto
Unhandled rejection

```

```auto
ResponseError: Response Error at IncomingMessage.<anonymous> (/usr/src/app/node_modules/@elastic/elasticsearch/lib/Transport.js:294:25) at IncomingMessage.emit (events.js:208:15) at IncomingMessage.EventEmitter.emit (domain.js:471:20) at endReadableNT (_stream_readable.js:1154:12) at processTicksAndRejections (internal/process/task_queues.js:77:11)

```

```auto
Error: Process exited with code 16 at process.<anonymous> (/usr/src/app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:393:29) at process.emit (events.js:203:13) at process.EventEmitter.emit (domain.js:471:20) at process.exit (internal/process/per_thread.js:158:15) at logAndSendError (/usr/src/app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:184:9) at process.<anonymous> (/usr/src/app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:390:13) at process.emit (events.js:203:13) at process.EventEmitter.emit (domain.js:471:20) at processPromiseRejections (internal/process/promises.js:201:33) at processTicksAndRejections (internal/process/task_queues.js:86:32)

```

```auto
Container called exit(16).

```

Note RE the code `16` - this is a fallback code the NPM module `@google-cloud/functions-framework` uses when there is an unhandled rejection

Is there a quick fix we can add to avoid this ending by crashing the container?

---

<div class="post-metadata">

**Author:** ![Matthew\_Petrie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_petrie/32/59145_2.png) [@Matthew\_Petrie](https://discuss.elastic.co/u/Matthew_Petrie)\
**Post date:** [February 25, 2020, 2:33pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858/2 "2020-02-25T14:33:08Z")

</div>

Potentially the above issue isn't related to the Elastic APM NPM module. I don't believe the Elastic APM NPM module uses the `@elastic/elasticsearch` NPM module at all (or any dependency of it)?

We do have another NPM module that uses `@elastic/elasticsearch` - am currently looking to see if this caused the issue

---

<div class="post-metadata">

**Author:** ![Lior\_Reuven](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lior_reuven/32/46412_2.png) [@Lior\_Reuven](https://discuss.elastic.co/u/Lior_Reuven)\
**Post date:** [February 25, 2020, 4:31pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858/3 "2020-02-25T16:31:24Z")

</div>

> [@Matthew\_Petrie](#):
>
> polling config

Thanks Mat,  
any chance you can set the agent on debug and see if the problem reproduce ? ([Troubleshooting | APM Node.js Agent Reference [4.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/nodejs/current/troubleshooting.html))  
In any case , the app shouldn't crash...

---

<div class="post-metadata">

**Author:** ![Matthew\_Petrie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_petrie/32/59145_2.png) [@Matthew\_Petrie](https://discuss.elastic.co/u/Matthew_Petrie)\
**Post date:** [March 3, 2020, 8:59pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858/4 "2020-03-03T20:59:41Z")

</div>

This ended up being an internal issue - apologies for the thread! Thanks for the prompt reply though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 24, 2020, 5:11pm UTC](https://discuss.elastic.co/t/service-unavailable-crashing-the-container/220858/5 "2020-03-24T17:11:09Z")

</div>

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