Skip to content

Fix file collision when running in workers.#197

Open
lpaolini wants to merge 1 commit intodriverdan:masterfrom
lpaolini:master
Open

Fix file collision when running in workers.#197
lpaolini wants to merge 1 commit intodriverdan:masterfrom
lpaolini:master

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.

1 participant