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

Fix file collision when running in workers. #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lpaolini
Copy link

@lpaolini lpaolini commented May 9, 2022

In XMLHttpRequest.js lines 479-480, two filenames are defined using process.pid as a unique key.

      var contentFile = ".node-xmlhttprequest-content-" + process.pid;
      var syncFile = ".node-xmlhttprequest-sync-" + process.pid;

However, when running in workers this is not enough, due to the fact that the process.pid is the same across workers. This causes a filename collision.

Appending a UUID to the key fixes the problem.

      var uniqueId = process.pid + "-" + uuid.v4();
      var contentFile = ".node-xmlhttprequest-content-" + uniqueId;
      var syncFile = ".node-xmlhttprequest-sync-" + uniqueId;

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.

None yet

1 participant