Render fails when removing a temporary directory hits a transient lock or network file system error
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- deno, typescript
- 領域
- build-system, cli
調査の方向性
Start in src/command/render/render-files.ts where the execute result is removed after the freezer copy, then read safeRemoveSync in src/deno_ral/fs.ts and removeIfEmptyDir in src/command/render/cleanup.ts. The maintainers have not chosen between a retry with delay, a warning, or writing directly to the freezer, so agree on the approach in the thread before coding. Done means a transient removal failure no longer aborts the render, reproduced by holding a file handle from another process on Windows or with a local NFS loopback mount on Linux.
索引モデルが issue の本文から書いたものです。
説明
During render, Quarto removes several directories it has just written or copied. Each removal is a single Deno.removeSync(path, { recursive: true }) attempt, and any error aborts the render. On network file systems, cloud-synced folders, or with another process scanning the folder (editor, antivirus, sync client), this removal can fail transiently even though the directory is empty a moment later.
This happens after all code has executed, so the user loses the whole render for a cleanup step.
Reported cases
All with the same pattern: removal right after write or copy, one attempt, fatal error.
execute-results removal in project render (removeFreezeResults):
- #15054: Linux NFS,
Directory not empty (os error 39), Quarto 1.10.18 - #8972: Windows mapped network drive,
An unexpected network error occurred. (os error 59), Quarto 1.4.550 - #2380 (comment from 2023-07-02): Google Drive,
NotFound (os error 2) - Discussions #6143 and #10775
Render cleanup of _files, libs and mediabag (renderCleanup, removeIfEmptyDir):
- #7993: Google Drive,
os error 2removing_files\libswithembed-resources - #6616: Windows,
os error 303thenos error 32removingmediabag, also on local disk with an editor open on the project - #4614 (closed by #7921)
Code path
In a project render, the execute result is written beside the document, copied to the freezer, then removed:
The removal goes through safeRemoveSync, which only ignores the error if the path is gone afterwards:
This was added for denoland/deno#18996 (removal succeeds but reports an error) and covers the Google Drive os error 2 case when the directory ends up removed. It does not cover cases where the directory still exists at the time of the check: NFS ENOTEMPTY, SMB os error 59, sharing violations.
Render cleanup has the same pattern:
Deno does not retry either. Deno.remove calls Rust std::fs::remove_dir_all, which on Linux returns ENOTEMPTY from the final rmdir directly, and on Windows only retries a few times without waiting, for ERROR_SHARING_VIOLATION (32) and ERROR_DIR_NOT_EMPTY (145).
Why the directory is empty right after
On NFS, unlinking a file that still has an open handle on the client renames it to a hidden .nfsXXXX file until the last handle closes (see "silly rename" in the Linux NFS FAQ). rmdir fails with ENOTEMPTY during that window. This matches what #15054 describes. On Windows, a sync client, antivirus, indexer or editor holding the file produces os error 32 / 145 / 303 the same way.
From my reading of the code, Quarto does not hold a handle on these files at removal time (all writes and copies use sync APIs that close the file). So the holder is another process, and we can't control it.
Prior work
-
#1536 added
safeRemoveIfExists(warn instead of fail). It is used for freezer pruning, with a comment about network drives, but not forexecute-results: -
#7921 and #10377 introduced and extended
safeRemoveSync. -
#10629 tried a retry loop on Windows. Measured on a local Windows mediabag lock: 74 to 300 attempts, 18 to 70 ms before success. Discussion there: we would prefer a pause-and-retry with a short timeout, and giving up silently on removal should not be the default. Closed unmerged.
Possible directions
We could:
- Retry the removal with a short sleep, only after a failure, so there is no cost in the normal case. Node's
fs.rmdoes this withmaxRetries/retryDelayforEBUSY,EMFILE,ENFILE,ENOTEMPTYandEPERM; on Windows, 32, 145 and 303 would be the matching codes.os error 59is not in any established retry list. - For
execute-resultsspecifically, report a warning instead of failing the render when the removal still fails, since the result is already in the freezer at this point. A leftoverexecute-resultsis not harmless (it could be picked on next thaw or end up in the output), so it should be cleaned up on the next execution. - Write the execute result directly into the freezer instead of beside the document. This removes the write-then-remove step entirely, but changes how the freezer mirrors
<doc>_files.
Testing will need a way to reproduce without a network share: holding a file handle from another process (Windows sharing violation) or a local NFS loopback mount on Linux.
- 主要言語
- JavaScript
- スター
- 6.1k
- フォーク
- 476
- 平均マージ
- 17時間 7分
- マージ済み PR(30日)
- 112
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/quarto-cli のほかの issue
-
enhancement websites
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/quarto-cli#15255 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Website announcement dismiss control cannot be reached or used with a keyboard対応中かも @Xander-AJ が今日担当しました。 オープンaccessibility bug websites
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
quarto-dev/quarto-cli#15235 ·
メンテナーはふだん 1 日以内に返信
-
quarto.json.decode does not raise on invalid JSON, so pcall cannot catch it対応中かも @sogav21 が 2 日前に担当しました。 オープンbug lua
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
quarto-dev/quarto-cli#15226 ·
メンテナーはふだん 1 日以内に返信
-
arrow-dark gives region markers a light band that fails contrast対応中かも @vav7 が 1 日前に担当しました。 オープンaccessibility bug themes
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
quarto-dev/quarto-cli#15222 ·
メンテナーはふだん 1 日以内に返信
-
bug code-annotation
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
quarto-dev/quarto-cli#15215 ·
メンテナーはふだん 1 日以内に返信
quarto-dev/quarto-cli の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
microsoft/playwright#43875 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Run the dependency drift check対応中かも @spaceninja が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
cloudfour/stylelint-config-cloudfour#683 ·
メンテナーはふだん 1 日以内に返信
-
Documentation Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JSPrismarine/JSPrismarine#2706 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PostHog/posthog-js#5524 ·
メンテナーはふだん 2 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 半日 初心者へのやさしさ 66/100
AlphaaCode/Popbook#10 ·