Skip to content

Build bug: process PID reuse with non-cleaned-up tmp directory #318

Closed
@chriskrycho

Description

@chriskrycho

The Bug

We use the process.pid for building the output directory:

let outDir = path.join(tmpdir(), `e-c-ts-${process.pid}`);

This can cause different builds (even from different apps) to end up with the same directory in the build tree. Here's the scenario where we triggered it:

  • running on CI, so reusing the same local directory for various apps (because it's just getting checked out to some default checkout directory)
  • the system temp directory we created doesn't get deleted for some reason (we don't delete it in e-c-ts at all as far I can see)
  • the PID happens to get recycled

When this happens, the actual same folder on disk gets reused, and you can end up with build artifacts from a previous build – including from totally separate applications! – in the build pipeline, causing runtime require resolution errors or similarly weird behaviors.

  1. We should generate a UUID or some such for those to make sure that this kind of collision isn't possible.
  2. We should be good citizens and clear the directory when we're done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuildIdeas for or bugs with the build process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions