node-export-server icon indicating copy to clipboard operation
node-export-server copied to clipboard

HTTP 400 error when sending lots of requests at once.

Open davidseverwright opened this issue 2 years ago • 10 comments

I've been having errors when sending multiple requests at once. It's a mix of HTTP 400 and timeouts.

In my setup, I have a queue runner sending reports. Every hour docker starts the export server and my queue runner, and then stops them both once the queue is empty.

I had the export server set to run 4 workers, and my queue runner was running 4 threads; there's no rate limiting so the 4 workers were getting hit non-stop. With the old export server this was fine, with 3.0.0-beta.2 it works for about ~125 requests then became 99% errors.

I've now changed it to only have 1 worker and 1 queue runner, and it's now running without issue. I've tried increasing the CPU and RAM allocated, seems to reduce the timeouts but still get the 400's.

All testing was done with around 600 charts being created 4 workers, 4 queues = bad (~125 queries, then very high errors.) 4 workers, 1 queue = fine 1 worker & 2 queues = eventually a few errors (~400 queries, then ~50% error for a while, then fine again) 1 worker & 1 queue = fine

The number of workers doesn't seem to matter, just the number of requests coming at once.

The attached log is with 4 threads sending requests, and --workers 4. 2vCPU and 8 GB of RAM, on AWS Fargate. With just one core and 2GB it's about the same error rate but more timeouts. The timeouts also increase over time, so maybe related to the memory leak bug?

highcharts-error.log

davidseverwright avatar Sep 21 '23 13:09 davidseverwright

Thanks for reporting!

Seems like it's related to: https://github.com/highcharts/node-export-server/issues/412

jszuminski avatar Sep 21 '23 19:09 jszuminski

@davidseverwright could you please share the following details:

  1. Are you injecting resources (JS/CSS)?
  2. Does the memory use increase over time for you?

jszuminski avatar Sep 22 '23 11:09 jszuminski

I'm not injecting any CSS/JS, and the memory usage is fluctuating a bit but isn't just climbing like the graph in #412.

With 4 workers and 4 jobs I get lots of errors and this: 4-jobs-at-once

With 4 workers and one job at a time, there's no errors and this: 1-job

davidseverwright avatar Sep 25 '23 15:09 davidseverwright

@davidseverwright we've recently merged a new PR (https://github.com/highcharts/node-export-server/pull/422) where we replaced the generic-pool package with tarn.

This could be a possible fix of this issue. Could you please try out the latest version (from the master branch or from the npm [email protected]) and let us know whether it solved it for you?

jszuminski avatar Oct 16 '23 09:10 jszuminski

Hi, thanks for looking into this.

It seems a lot better (less errors) but there are still errors. The log is attached. This was run with 4 workers, and 4 simultaneous requests. It's still all OK with one request at a time.

hces-errors.txt

davidseverwright avatar Oct 20 '23 16:10 davidseverwright

Hi @davidseverwright

Thank you for all the information. We released v3.0.2 recently. Could you check how the server performs on your side with this version?

PaulDalek avatar Nov 16 '23 12:11 PaulDalek

Hi,

I just tested this with Highcharts v11.2 and export server v3.0.3, and got the same errors. hces.log

davidseverwright avatar Nov 27 '23 12:11 davidseverwright

noting we've been seeing increased 400's against the official highcharts export server as well.

shawnwall avatar Jan 18 '24 20:01 shawnwall

Facing the same issue. The app requesting charts from server constantly gets 400s.

Found this in error logs.

Wed Mar 27 2024 22:31:41 GMT+0000 [error] - [export] Error encountered during export: Error: Rasterization timeout Wed Mar 27 2024 22:31:41 GMT+0000 [error] - [export] Error encountered during export: Error: Rasterization timeout Wed Mar 27 2024 22:31:42 GMT+0000 [error] - [export] Work: b8596f4cbb744301ba483c3fca412341 could not be completed, sending: In pool.postWork: Error trying to perform puppeteer export: In pool.postWork: Error: Rasterization timeout.

anantjagania avatar Mar 27 '24 22:03 anantjagania

We have the same issue.

Sometimes after exporting of images via highcharts it redirects to "not working" page.

Will you fix this issue or we need to find alternative to highchart export?

It is very critical for us to have stable export on website which always works.

Screenshot_56

dmytromakohin avatar Apr 16 '24 13:04 dmytromakohin

Most likely fixed by https://github.com/highcharts/node-export-server/pull/521 in v4.0.0 (currently on the master branch).

jszuminski avatar Jul 25 '24 10:07 jszuminski