yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Possible race condition - Workspaces Hoisting & buildActionsForCopy

Open mattfysh opened this issue 5 years ago • 3 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

yarn add <pkg> in a package of a workspaces structure fails, with ENOENT, due to yarn attempting to lstat on a folder that has been hoisted.

This is the lstat in question: https://github.com/yarnpkg/yarn/blob/158da6c6287cbc4fee900e3704f140c3391dc28d/src/util/fs.js#L254

  1. On line 246, the directory would have had to exist, otherwisedestFiles would not have been successfully instantiated
  2. Once it (asynchronously) reaches lines 254, one of the folders referenced in destFiles no longer exists and causes the lstat to fail. I suspect it no longer exists due to workspace hoisting

If the current behavior is a bug, please provide the steps to reproduce.

Suspect that this bug only occurs in large dependency graphs. Running the same command again gets it work?

What is the expected behavior?

For yarn install to complete successfully. Race conditions need to be identified and removed

Please mention your node.js, yarn and operating system version.

node v11.7.0 yarn v1.13.0 macOS 10.14.2

mattfysh avatar Jan 20 '19 06:01 mattfysh

@arcanis - I'm happy to dig further and try to submit a pull request. Any pointers before I do? thanks

mattfysh avatar Jan 21 '19 22:01 mattfysh

this is an issue for me.. I have a large dependency graph (because of @angular and @nestjs packages) and continuously run into this error when running yarn install.

johannesschobel avatar Jul 25 '19 16:07 johannesschobel

Same here...

Bartel-C8 avatar Nov 13 '23 14:11 Bartel-C8