Skip to content

yarn_install time out with large dependency amount #2231

Closed

Description

@kyubisation

🐞 bug report

Affected Rule

The issue is caused by the rule:

yarn_install (would probably also happen with npm_install)

Is this a regression?

No

Description

With a large amount of dependencies in a project, yarn_install results in a "Timed out".
More precisely it is the _create_build_files execute, which calls generate_build_file.ts (in my test it timed out during findPackages()).

It works, if I extend the timeout for the repository_ctx.execute in _create_build_files.

🔬 Minimal Reproduction

Tested with https://github.com/angular/components
bazel build src/cdk/bidi

🔥 Exception or Error





INFO: Repository npm instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule yarn_install defined at:
  /home/lukas/.cache/bazel/_bazel_lukas/14787a90d7607eee821eb51658cd0614/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:450:16: in 
ERROR: An error occurred during the fetch of repository 'npm':
   Traceback (most recent call last):
        File "/home/lukas/.cache/bazel/_bazel_lukas/14787a90d7607eee821eb51658cd0614/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 448
                _create_build_files(<4 more arguments>)
        File "/home/lukas/.cache/bazel/_bazel_lukas/14787a90d7607eee821eb51658cd0614/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 162, in _create_build_files
                fail(<1 more arguments>)
generate_build_file.ts failed:
STDOUT:

STDERR:
Timed out
ERROR: no such package '@npm//': Traceback (most recent call last):
        File "/home/lukas/.cache/bazel/_bazel_lukas/14787a90d7607eee821eb51658cd0614/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 448
                _create_build_files(<4 more arguments>)
        File "/home/lukas/.cache/bazel/_bazel_lukas/14787a90d7607eee821eb51658cd0614/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 162, in _create_build_files
                fail(<1 more arguments>)
generate_build_file.ts failed:
STDOUT:

STDERR:
Timed out

🌍 Your Environment

Operating System:

  
WSL 2 Ubuntu 20.04 (Windows 10)
  

Output of bazel version:

  
Bazelisk version: v1.6.0
Build label: 3.1.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Apr 22 10:32:27 2020 (1587551547)
Build timestamp: 1587551547
Build timestamp as int: 1587551547
  

Rules_nodejs version:

(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)

  
2.2.0
  

Anything else relevant?

Activity

  1. added a commit that references this issue on Oct 17, 2020
    193cd42
  2. added a commit that references this issue on Oct 17, 2020
    e72c145
  3. kyubisation commented on Oct 17, 2020

    @kyubisation
    ContributorAuthor

    @alexeagle Thank you very much for the fix. This might simply be caused by performance limitations in WSL.

  4. added a commit that references this issue on Oct 21, 2020
    5d405a7
  5. added a commit that references this issue on Jan 15, 2021
    9671291
  6. arnaudgibert commented on Jun 21, 2021

    @arnaudgibert

    I still got the problem even with this fix. So for future references, doing a simple bazel clean can save you a lot of trouble. 😉

  7. kyubisation commented on Jun 22, 2021

    @kyubisation
    ContributorAuthor

    Also a lesson learned; I previously used the mounted Windows drives from WSL, which is extremely slow and generally not recommended (for this use case). I have since switched to directly using the WSL file system.

  8. arnaudgibert commented on Jun 22, 2021

    @arnaudgibert

    And for those who still use wsl1 try wsl2 which is way faster for I/O on drive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions