`nuxt dev` reload never finishes when a Nuxt `close` hook doesn't settle
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, nuxt, typescript
調査の方向性
Start in packages/nuxt-cli/src/dev/utils.ts at #load() and close(), then read the shutdown budget in packages/nuxt-cli/src/dev/pool.ts and its closeFork logic. Check existing dev reload tests and add coverage for a Nuxt close hook that never settles. Done means reload proceeds after the shutdown deadline, reports the unfinished hooks, and the test passes.
索引モデルが issue の本文から書いたものです。
説明
Environment
@nuxt/cli4.0.3 (same code onmain, 7d4dec6)nuxt4.6.4,nitropack2.13.6,vite8.3.6- Node 24.22.2, Linux x64
Reproduction
https://github.com/mttzzz/nuxt-reload-close-hook-hang
The app has one local module:
// modules/hang-on-close.ts
import { defineNuxtModule } from 'nuxt/kit'
export default defineNuxtModule({
meta: { name: 'hang-on-close' },
setup(_options, nuxt) {
nuxt.hook('close', () => new Promise<void>(() => {}))
},
})
npm i && npx nuxt dev, the page showsmarker: one- change
marker: 'one'to'two'innuxt.config.ts
Describe the bug
After step 2 the page switches to the loading screen (503) and stays there (I waited 80 s), the reload is never reported as done. Saving nuxt.config.ts again does nothing, since the config watcher is closed before the reload and only re-armed after it. Ctrl-C still exits right away, so restarting nuxt dev is the only way out.
Without the module the same edit reloads in about 1 s. The same kind of hook in a Nitro plugin (nitroApp.hooks.hook('close', () => new Promise(() => {}))) only delays the reload by about 5 s: nitropack terminates the dev worker after NITRO_SHUTDOWN_TIMEOUT, and the reload goes on.
This came up in #1328, where @danielroe asked for a separate issue.
Cause
An in-place reload (a nuxt.config change, removed build output, nuxt.callHook('restart') from a module) goes through #load(), which awaits close(), and close() awaits this.#currentNuxt.close() with no deadline:
nuxt.close() calls the close hooks one after another, so the hooks registered after the module (Nitro's, Vite's, the builder watchers) are never called either.
Shutting the fork down already has a budget: closeFork waits DEV_SHUTDOWN_TIMEOUT_MS (10 s), then sends SIGTERM and SIGKILL:
The reload could get the same budget: race currentNuxt.close() against DEV_SHUTDOWN_TIMEOUT_MS, warn that the close hooks didn't finish, and go on with the reload. I can send a PR for that.
- 主要言語
- TypeScript
- スター
- 402
- フォーク
- 125
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 37
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nuxt/cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
dev: false "reachable from the network" warning when `devServer.host` is a `*.localhost` subdomain再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
[Bug]: Search input loses focus while typing on the Inventory, Reservations and Locations lists (view_configurations enabled)対応中かも @medusa-os-bot が今日担当しました。 オープンstatus: needs triaging type: bug version: 2.0
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
medusajs/medusa#17886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
marimo-team/marimo#11949 ·
メンテナーはふだん 1 日以内に返信
-
bug server-time v2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/servers#5559 ·
メンテナーはふだん 1 日以内に返信
-
D1 Time Travel restore help advertises 30 days without a plan qualifier対応中かも @akhil9tiet が今日担当しました。 オープンbug package:wrangler product:d1
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/workers-sdk#17000 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug severity:medium triage:confirmed triage:reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Cotal-AI/Cotal#7440 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信