Skip to content

Conversation

@ZerozAndOnes
Copy link
Owner

kvasserman and others added 3 commits August 18, 2021 15:13
Under heavy load (in the context of web application, for example using nestjs) some of the requests fail:

1. According to child process documentation (https://nodejs.org/docs/latest-v14.x/api/child_process.html#child_process_event_exit), exit even can fire before stdio is closed.
In such cases respond() is being called with code 0 (success), no error and no data. This results in an error in the calling code, because filename is expected but is not returned.
I added additional error checking to respond() to handle this case.

2. Given the above, it's probably not a good idea to subscribe to exit event at all. I commented out the on('exit'..) code. on('close') should be sufficient.

Tested it under some load (30 concurrent connections for 2 minutes) - no errors, 5000+ PDFs rendered.
ZerozAndOnes added a commit that referenced this pull request Jul 14, 2022
Under concurrent load, child process exit event fires before IO is complete, causing errors fix with tests #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants