highcharts / highcharts/node-export-server

Pool not released after (a specific) Puppeteer error

Open
#640 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
369
Forks
266
PR merge metrics
No merged PRs in 30d

Description

We are running the Highcharts export server on Heroku. At some point we get some Puppeteer detached frame errors. We are not sure why, maybe because of the specific chart configs being exported (to SVG). However, those export requests crashing isn't that big of a deal, but after those errors the worker pool seems to be exhausted (old workers are not released to the pool) and all subsequent requests crash with "Error encountered when acquiring an available entry". They keep crashing until we manually restart the export server.

So in detail, we first get two of these errors (we have a minWorker pool size of 2):
```
Request to export server not successful. code: 400, response: {"statusCode":400,"message":"[pool] In pool.postWork: Attempted to use detached Frame 'B3381E6334D5B8B0CADB3E9197D43969'."}
```

After which all subsequent requests crash with:

```
Request to export server not successful. code: 400, response: {"statusCode":400,"message":"[pool] In pool.postWork: For request with ID e0b3bd5f9ec04233ae22320e5ab5f370 - Error encountered when acquiring an available entry: 5001.070848ms."}
```

Looking at the code in [pool.js](https://github.com/highcharts/node-export-server/blob/4.0.2/lib/pool.js#L356), the worker should be released after the first error, but for some reason it doesn't and we can't acquire any new workers afterwards. So we end up with a running export server process with no workers in the pool at all, which seems pretty useless. Only way to fix this is to (manually) restart the process.

Any help with this would be appreciated!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.