[BUG] <The library seems to not be safe with multiple webworkers>
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- electron, javascript
- Domain
- tooling
Research direction
Start at the writeFileSync entry point and compare it with writeFile, as the report suggests both may be affected. Reproduce concurrent writes to the same file from multiple webworkers in Electron and trace the temporary-file, permission, write, and deletion sequence. Done means concurrent writes no longer fail with the reported ENOENT error while preserving atomic behavior.
Written by the indexing model from the issue text.
Description
What / Why
With reference with the following but https://github.com/sindresorhus/conf/issues/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?
- Dominant language
- JavaScript
- Stars
- 256
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from npm/write-file-atomic
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
npm/write-file-atomic#245 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 50/100
npm/write-file-atomic#243 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
npm/write-file-atomic#224 ·
-
PornographyOpen
Difficulty 5/5 Over a week Newbie friendliness 1/100
npm/write-file-atomic#189 · 6 reactions ·
-
Bug Needs Triage
Difficulty 3/5 1-2 days Newbie friendliness 35/100
npm/write-file-atomic#163 ·
All issues in npm/write-file-atomic
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
scratchfoundation/scratch-editor#754 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 96/100
google/site-kit-wp#14102 ·
Maintainers usually reply within 2 days
-
area:growth priority:P1 type:docs
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tecnologiasantos/bogoboom#66 ·
Maintainers usually reply within 1 day
-
desktop docs good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ktwu01/benchmark-radar#1181 ·
Maintainers usually reply within 1 day