Skip to content

T-009: ENOTDIR race condition in copyFiles during node ace build on virtualized filesystems (Docker Desktop / DevContainers / WSL2) - #127

Merged
thetutlage merged 1 commit into
8.xfrom
task/T-009
Nov 16, 2026
Merged

thetutlage merged 1 commit into
8.xfrom
task/T-009

Conversation

@fleet-panda

@fleet-panda fleet-panda Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #125

Goal

copyFiles of @adonisjs/assembler (src/utils.ts) created the destination folder of each file inside Promise.all. Several files that share a nested folder ran mkdir(..., { recursive: true }) on the same path at once. On the virtualized filesystems of Docker Desktop and devcontainers, that can fail with ENOTDIR, and node ace build fails now and then.

copyFiles now creates each unique destination folder first, one after the other. Then it copies the files in parallel, as before.

Deployment requirements

  • Release @adonisjs/assembler as a patch.

Acceptance criteria

npm run lint and npm run typecheck pass. npm run quick:test: 305 tests pass and 1 test fails. The failed test is not about this change. See "Checks".

  • copyFiles creates each unique destination folder once, before it copies any file, then copies the files in parallel as today.
    • Proof: the diff of src/utils.ts, and the debug output of the new test. The folders are in a Set, and they are created before Promise.all copies the files. Pass.
      ADONISJS:ASSEMBLER: creating directories Set(3) {
        '<repo>/tmp/build/resources/views',
        '<repo>/tmp/build/resources/views/emails',
        '<repo>/tmp/build/resources/views/emails/layouts'
      }
      ADONISJS:ASSEMBLER: copying files [
        'resources/views/welcome.edge',
        'resources/views/emails/a.edge',
        'resources/views/emails/b.edge',
        'resources/views/emails/c.edge',
        'resources/views/emails/layouts/main.edge'
      ] to destination "<repo>/tmp/build"
      
  • A test copies several files that share a nested destination folder, and each one is copied.
    • Test: copy several files that share a nested destination directory in tests/utils/copy.spec.ts. Pass.

Checks

  • npm run lint: pass.
  • npm run typecheck: pass.
  • npm run quick:test: 305 pass, 1 fails. The failed test is tests/dev_server.spec.ts, which expects the dev server on port 3334. On the build machine, another dev server held port 3334, so getPort() gave a random port. The same test fails on the unchanged 8.x. It does not touch copyFiles.
  • The race does not happen on a native filesystem, so no test can show the ENOTDIR failure.

Decisions about the code

  • The folders are created one after the other, not in parallel. Two different folders can share a parent, for example build/resources/views and build/resources/views/emails. Parallel recursive calls on them can still create build/resources at the same time.

Context changes

None.

Discovered work

  • The test of tests/dev_server.spec.ts that expects Server address: cyan(http://localhost:3334) fails when another process listens on port 3334. It depends on a free port of the machine.

Concurrent recursive mkdir calls for the same nested folder fail with
ENOTDIR on virtualized filesystems, like Docker Desktop mounts.
copyFiles now creates each unique destination folder one after the
other, then copies the files in parallel.

Fixes #125
@thetutlage
thetutlage merged commit ed63ab8 into 8.x Nov 16, 2026
10 checks passed
@thetutlage
thetutlage deleted the task/T-009 branch November 16, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENOTDIR race condition in copyFiles during node ace build on virtualized filesystems (Docker Desktop / DevContainers / WSL2)

1 participant