Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

watch mode triggers unsolicided messages to Workers

オープン
#65,044 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
javascript, node.js
領域
backend

調査の方向性

まず、main.mjs、worker.js、node --watch を使って報告された再現手順を実行し、次に "watch:require" メッセージを出力する worker と watch モードの処理を追跡します。このケースで worker が要求していないメッセージを受信せず、一貫して再現可能な動作に対するリグレッションテストのカバレッジがあることをもって完了とします。

索引モデルが issue の本文から書いたものです。

説明

Version

24.19.0, 26.6.0

Platform
Linux 05338a186e89 6.18.33.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Fri Jun  5 01:12:21 UTC 2026 x86_64 Linux
Subsystem

worker

What steps will reproduce the bug?

given the following two files:

// main.mjs
import { Worker } from 'worker_threads'
const worker = new Worker('./worker.js')
worker.on('message', console.log)
// worker.js (can be empty)

it can be reproduced using node --watch main.mjs.

The behavior is identical when using an equivalent main.cjs instead.

How often does it reproduce? Is there a required condition?

reproduces consistently

What is the expected behavior? Why is that the expected behavior?

applications should not receive unexpected (and undocumented) messages by the engine.

What do you see instead?

Unsolicided "watch:require" messages are sent.

Additional information

This issue effects v24 and v26, as can be seen in the following log (tested with node.js v22.23.1, v23.11.1, v24.19.0, v25.9.0, v26.6.0; note that I aborted each run with ctrl+c)

$ docker run --rm -v .:/app -w /app node:22-alpine   node --watch main.mjs
Completed running 'main.mjs'. Waiting for file changes before restarting...

$ docker run --rm -v .:/app -w /app node:23-alpine   node --watch main.mjs                                                 
Completed running 'main.mjs'                  

$ docker run --rm -v .:/app -w /app node:24-alpine   node --watch main.mjs
{ 'watch:require': [ '/app/worker.js' ] }
Completed running 'main.mjs'. Waiting for file changes before restarting...

$ docker run --rm -v .:/app -w /app node:25-alpine   node --watch main.mjs
Completed running 'main.mjs'. Waiting for file changes before restarting...

$ docker run --rm -v .:/app -w /app node:26-alpine   node --watch main.mjs
{ 'watch:require': [ '/app/worker.js' ] }
Completed running 'main.mjs'. Waiting for file changes before restarting...

Though robust message handling code should always validate and check received messages, such unexpected messages can lead to unexpected behavior, e.g. crashes. This unexpected node.js behavior leads to the following issue downstream with an XML schema validating library: https://github.com/noppa/xmllint-wasm/issues/37

主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 3時間
マージ済み PR(30日)
279

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/node のほかの issue

nodejs/node の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。