Skip to content

Parallel workers running install scripts can interfere #1874

@janv

Description

@janv

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

Bug

What is the current behavior?

We have a fairly large package.json. Since switching to yarn, our CI builds would randomly fail around 7% of the time when compiling binary modules.

What was super weird is that the C compiler complained about files that were apparently truncated. Those files were node.js header files, downloaded by node-gyp before the compilation process. Since gyp verifies the integrity of these files, they can't be corrupted at the source. The corruptions occurred in different files and on different lines every time.

After a lot of trial and error, I was unable to reproduce the error when I only installed the single offending module alone. This leads me to believe that the parallelization of work during yarn install somehow leads to two parallel downloads of the node headers that overwrite each other.

I have no hard evidence and trouble reproducing this. I was just wondering if this is really a possibility or if I'm barking up the wrong tree. I searched in a multitude of other directions, all without result. The randomness of the occurrence indicates a concurrency issue.

Please advise

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

This is extremely hard to reproduce, see above description. If desired I can attach our package.json and yarn.lock

What is the expected behavior?

Since external scripts cannot be guaranteed to be concurrent, don't execute them in parallel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions