Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxListeners warning when running multiple processes in parallel #765

Closed
ehmicky opened this issue Feb 1, 2024 · 0 comments · Fixed by #785
Closed

maxListeners warning when running multiple processes in parallel #765

ehmicky opened this issue Feb 1, 2024 · 0 comments · Fixed by #785

Comments

@ehmicky
Copy link
Collaborator

ehmicky commented Feb 1, 2024

When running more than 10 execa() calls in parallel, a maxListeners warning is printed.

For this bug to happen, the option must be an array, and one of the value must be 'inherit' (or the equivalent 0, 1, 2, process.stdin, process.stdout or process.stderr). That's because each process pipes from/to the same global object, which creates more than 10 event listeners on that event emitter.

await Promise.all(Array.from({length: 11}, () => execa('...', {
  stdin: ['pipe', 'inherit'], 
  stdout: ['pipe', 'inherit'], 
  stderr: ['pipe', 'inherit'],
}));
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 a pull request may close this issue.

1 participant