Skip to content

fix(logger): prevent EEXIST race condition in parallel environment - #2294

Open
devxdh wants to merge 1 commit into
asyncapi:masterfrom
devxdh:fix-logDir-race
Open

fix(logger): prevent EEXIST race condition in parallel environment#2294
devxdh wants to merge 1 commit into
asyncapi:masterfrom
devxdh:fix-logDir-race

Conversation

@devxdh

@devxdh devxdh commented Sep 3, 2026

Copy link
Copy Markdown

Resolves #2293

Problem

When multiple CLI instances run concurrently in fresh environments (e.g. parallel builds in Docker), logger.ts can
crash with EEXIST: file already exists, mkdir .../logs if two processes try to create the logs/ directory at the
exact same moment.

Solution

Added { recursive: true } to fs.mkdirSync in src/utils/logger.ts to make directory creation idempotent (like
mkdir -p) and prevent race conditions.

Tested with 50 rounds of 8 concurrent processes in Docker and verified all unit tests pass (npm run cli:test).

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1a95206

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

@devxdh
devxdh marked this pull request as ready for review September 3, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

[BUG] asyncapi cli race condition crash

1 participant