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

[BUG] <The library seems to not be safe with multiple webworkers> #57

Open
oltreseba opened this issue Jan 29, 2020 · 0 comments
Open
Labels
Bug thing that needs fixing

Comments

@oltreseba
Copy link

What / Why

With reference with the following but sindresorhus/conf#102, it appears that in a multiple webworker environment the library may have problems.
I'm working inside an electron app.

What is happening when multiple webworkers try to write the same file:

  • Webworker 1 -> create tmp file
  • Webworker 2 -> create same tmp file (apparently the file name depends on the pid, which is the same from all the webworkers, at least in an electron environment)
  • Webworker 1 -> set file permission, write the file and delete it
  • Webworker 2 -> set file permission, but cannot since the file does not exists anymore. And throw an exception.

I'm getting the following exception:

ENOENT: no such file or directory, chown '/Users/oltreseba/Library/Preferences/project-nodejs/config.json.1638900804'

When

This happen when i try to write the same file from multiple webworkers. It may not happen always since it's related with multithreading.

Where

writeFileSync function. But probably writeFile has the same problem?

How

Current Behavior

The function throw an exception when attempting to write a not-exiting file.

Steps to Reproduce

Start multiple workers that write to the same file.

Expected Behavior

The file access should be piped probably?

@darcyclarke darcyclarke added the Bug thing that needs fixing label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants