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

fix(pacmak): EMFILE error when running jsii-pacmak #1891

Merged
merged 4 commits into from
Aug 18, 2020

Commits on Aug 14, 2020

  1. fix(pacmak): EMFILE error when running jsii-pacmak

    The `findLocalBuildDirs` function did not have a protection against
    inspecting the same `package.json` file multiple times, and
    asynchronously traverses the whole dependency tree under the built
    package. In certain pathological cases, dependencies could be processed
    many times around (think about how `@aws-cdk/aws-iam` is a direct or
    transitive dependency of nearly every other `@aws-cdk/aws-*` module).
    The asynchronous nature of the process means that *many* instances of
    the same file could be opened at the same time, occasionally inching
    above the maximum file descriptor count limit, hence causing `EMFILE` (
    which is the standard error code for "too many files open").
    
    This change adds a `visitedDirectories` set to prevent re-visiting the
    same dependency instance multiple times (based on the absolute path of
    the package root). This incidentally also improves the performance of
    the process, since making promises incurs overhead, and not
    re-processing directories multiple times cut out a significant chunk of
    the promises made in extreme cases.
    
    Special thanks to @richardhboyd for having me look into this particular
    problem.
    RomainMuller committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    331de0f View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2020

  1. Configuration menu
    Copy the full SHA
    0f9222a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0adfe53 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    99b1464 View commit details
    Browse the repository at this point in the history