`FileSystem.Lock.aquire` ends in `UnexpectedError ENOENT` when the lock is released while it checks it
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
調査の方向性
まず、compiler-node のソース内で LockMetaCheck handler と FileSystem のエラープレディケートを見つけます。churn.js が .lock を繰り返し削除している間に、リンクされた再現手順または gren make/node コマンドを実行します。短時間だけ消える lock が再試行され、実行時に UnexpectedError ENOENT が報告されなくなり、lock acquired または already locked の結果だけで終了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Found against: gren 0.6.6, gren-lang/compiler-node 5.0.0, gren-lang/core 7.4.2, gren-lang/node 6.1.3, node 22
Reproduction: https://github.com/gilramir/gren-bug-reports/tree/main/2026-09-16-lock-vanishes-during-metadata
Taking a lock that another process holds only briefly often ends in
UnexpectedError, when it should end with the lock taken or AlreadyLocked.
aquire creates the lock directory; if it exists, it reads its metadata to see
whether the lock is stale. If the other process removes the lock in between,
metadata fails with ENOENT, and the handler that means to retry tests for
the wrong error.
Reproduction
gren.json: a node application with "gren-lang/compiler-node": "5.0.0", "gren-lang/core": "7.4.2", "gren-lang/node": "6.1.3" (indirect "gren-lang/compiler-common": "3.0.0", "gren-lang/url": "6.0.0").
churn.js stands in for another process that holds the lock very briefly:
// Create and remove ./.lock in a tight loop, as another process holding the
// lock very briefly would.
const fs = require("node:fs");
for (;;) {
try { fs.mkdirSync(".lock"); } catch (e) {}
try { fs.rmdirSync(".lock"); } catch (e) {}
}
src/Main.gren tries to take the lock 2000 times, without retries, releasing it
whenever it gets it, and counts how each attempt ended:
(source elided here as it's very long)
gren make Main --output=app
node churn.js &
node app
Output (counts vary with timing):
outcome count
UnexpectedError ENOENT 953
already locked 156
lock acquired 891
Cause
LockMetaCheck { path, attempt, result = Err fsErr } ->
if FileSystem.errorIsFileExists fsErr then
-- Lock might have been removed while we asked for metadata
update fsPerm (Lock { path = fromLockPath path, attempt = attempt + 1 }) model
else
UnexpectedError { path = fromLockPath path, error = fsErr }
The comment describes the right recovery, but reading a directory's metadata
never fails with EEXIST, so a lock that has been removed takes the else
branch.
Proposed Fix
The check should be FileSystem.errorIsNoSuchFileOrDirectory
With it, the same program gave 325 already locked and 1675 lock acquired.
- 主要言語
- JavaScript
- スター
- 2
- フォーク
- 3
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gren-lang/compiler-node のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
gren-lang/compiler-node#15 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
gren-lang/compiler-node の issue をすべて見る
似ている issue
-
factory-active factory-automatic harness/codex task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
ux
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
rr-djk/rr-djuikoo.com#53 ·
メンテナーはふだん 1 日以内に返信
-
new spec review
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
w3c/browser-specs#2666 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
thim81/openapi-format#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
decentespresso/dye2#13 ·