nodejsのバグを見つけたのでPRを投げてみた

Share

概要

要するに、node --testで特定のバイナリを標準出力に書くと、テストランナーが固まったり、異常終了したりするバグです。

バグ自体は既知のものだったようで、修正がされていました。

test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size bytes · Issue #62693 · nodejs/node
Version v25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0) Platform Darwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020…

ただ、手元で使っていたv22では修正が配布されていなかったので、PRを投げたという形です。

[v22.x backport] test_runner: avoid hanging on incomplete v8 frames by P4suta · Pull Request #65807 · nodejs/node
Backport #62704 and #64706 together to v22.x-staging to fix test-runner hangs and deserialization errors triggered by binary child stdout. This follows up on #64706 (comment). Why backport to Maint…

今回取り込んだのは、無限ループを防ぐ修正と、データの長さを符号なし整数として扱う修正の2つです。

感想

V8のビルド時間が長かった。作業時間的には3時間ぐらい。

続編

PRを投げてしばらく待っていたら、続々とApproveがされていった。たまに裏の自動化システムがCIを走らせてくれたのだが、ことごとくfail。

何かまずいことでもしたのかなとJenkinsの方を見てみてもPermissionがなく何も見れないので、静観を決め込む。

Jenkinsのログは見れず....

それとは別に頻繁に出されるCIのリクエスト、どれも撃沈。

何が起きているんだろうなあと思いつつも、よくわからないので静観していたわけだが、リリース担当者からコメントが投稿される。

Sadly this is not gonna make it to the v22.23.3 release due to CI and timing. I've pospone this release too much now.
[v22.x backport] test_runner: avoid hanging on incomplete v8 frames by P4suta · Pull Request #65807 · nodejs/node
Backport #62704 and #64706 together to v22.x-staging to fix test-runner hangs and deserialization errors triggered by binary child stdout. This follows up on #64706 (comment). Why backport to Maint…

ということで、次回リリースに間に合わないんだと。原因はCIがコケてること。

ほうほう、まあ仕方ないなあと思いつつ、どうやらCI起因で相手も大変そうなので私の方でできるかわからないが調査してみることに。

完全なログではないが、ざっくり何が起こっているかはnodejs/reliability/reportsにまとまっていることが分かったので軽く眺めてみることに。

reliability/reports/2026-09-11.md at main · nodejs/reliability
Make the CI green again. Contribute to nodejs/reliability development by creating an account on GitHub.

9/11から9/16までのログを眺めてみると以下のエラーが出ているとわかる。

Error: [WinError 5] Access is denied: '...\clcache\stats.txt.new' -> '...\clcache\stats.txt'

なるほど、どうやらビルドでclcacheとやらが上手くいっていないようだな、と。

build/jenkins/scripts/windows/compile.cmd at 34fc8413cf179a8f08a9653eef3763da6c7fefef · nodejs/build
Better build and test infra for Node. Contribute to nodejs/build development by creating an account on GitHub.

件のファイルはこれ。

clcacheというのはfrerich/clcacheというプロジェクトのもので、いってしまえばnodejsに関係なく上流の問題というわけ。

GitHub - frerich/clcache: A compiler cache for MSVC, much like ccache for gcc
A compiler cache for MSVC, much like ccache for gcc - frerich/clcache

さて、じゃあfrerich/clcacheにPR出せばいいかと思いきやそうともいかない。

というのも、すでにこのプロジェクトはarchiveされているのである。readonlyなので新規にどうもこうもできない。

いやはやここで手詰まりか、いやそんなことはないのだ。

調べてみれば、全く同じ問題にぶち当たっている人がいるではないか!

PermissionError: [WinError 5] Access is denied if using build multithreads > 3 · Issue #342 · frerich/clcache
Hello, I’m enabling the clcache in the Uefi firmware MSVC build toolchain. I’ve enable thed ccache in our GCC/CLang toolchains and I hope the clcache can work in our MSVC toolchain as well. I built…

ここの書き込みによれば、次の通りである。

you should move clcache dir, not clcache binary. It can be configured through CLCACHE_DIR environment
It works with threads > 4 after I set CLCACHE_DIR=C:\clcache_dir

ということなので、nodejsでも同じ対応をしようじゃないか。

Windows CI: clcache fails with ”[WinError 5] Access is denied” on stats.txt · Issue #4471 · nodejs/build
node-compile-windows has been failing since 2026-09-11 with: Error: [WinError 5] Access is denied: ‘C:\Users\Administrator\clcache\stats.txt.new’ -> ‘C:\Users\Administrator\clcache\stats.txt’ Scope…

調査結果と修正をIssueで起票してみた

ということで、作ってみたPRがこちら。

jenkins,win: move clcache cache out of user profile by P4suta · Pull Request #4472 · nodejs/build
Fixes #4471 compile.cmd sets CLCACHE_BASEDIR but not CLCACHE_DIR, so clcache stores its cache in %USERPROFILE%\clcache. That is the configuration reported in frerich/clcache#342 to fail with: Error…

変更内容は jenkins/scripts/windows/compile.cmd に set CLCACHE_DIR=C:\clcache_dir を追記するだけ。

一旦これで直るはず。即効性が欲しい時は DISABLE_CLCACHE=1 でイケるはずと、Issueにも書いておいた。

上手くいくといいな。

Read more

ChatGPTをPro 500で使う

ChatGPTをPro 500で使う

ChatGPTのプランが刷新され、ヘビーユーザー向けのプランが3 Tierに分割された。 Pro 100/200/500で分かれたのだが、エンジニアとしてAIを使いまくる身としてはPro 500一択である。 ということで、お布施で配られたCreditを使い切ったタイミングでPro 500プランに変更。 だが、あれ?思ったほど使える感じがしない...? まあ気にせず使っていたのだが、OpenAIからメールが。 Hello, We’re contacting you because an error prevented your weekly Codex and Work usage allowance from increasing when you upgraded from Pro 200 to Pro 500. Your account kept the allowance from

By Sakashita Yasunobu

Dependabotの対応が面倒なのでRenovateを導入する

Dependabotくんはある程度の依存関係の更新を通知してくれるが、山のようにprojectを抱えているとなんとも痒いところに手が届かない。 ということで、Renovateを使ってみる。 Build software better, togetherGitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.GitHub ここからGitHub Appを入れる。 あとは、指示に従ってポチポチするだけで、超かんたんだった。 感想 自動化最高。

By Sakashita Yasunobu
青空文庫のParser

青空文庫のParser

青空文庫のParserを作ってます。 GitHub - P4suta/aozora: Pure-functional Rust parser for 青空文庫記法 (Aozora Bunko notation): ルビ, 傍点, 縦中横, 外字, 返り点, indent containers, page breaks.Pure-functional Rust parser for 青空文庫記法 (Aozora Bunko notation): ルビ, 傍点, 縦中横, 外字, 返り点, indent containers, page breaks. - P4suta/aozoraGitHubP4suta Rustで作ってますが、配布物はcargoのほかにnpm/pypiでも入手できます Documentation * Playground — try it in

By Sakashita Yasunobu