`nuxt dev` reload never finishes when a Nuxt `close` hook doesn't settle
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, nuxt, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 402
- Fork
- 125
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nuxt/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
dev: false "reachable from the network" warning when `devServer.host` is a `*.localhost` subdomainCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
[Bug]: Search input loses focus while typing on the Inventory, Reservations and Locations lists (view_configurations enabled)Có thể đã có người làm @medusa-os-bot đã nhận hôm nay. Đang mởstatus: needs triaging type: bug version: 2.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
medusajs/medusa#17886 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
marimo-team/marimo#11949 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug server-time v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelcontextprotocol/servers#5559 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
D1 Time Travel restore help advertises 30 days without a plan qualifierCó thể đã có người làm @akhil9tiet đã nhận hôm nay. Đang mởbug package:wrangler product:d1
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
cloudflare/workers-sdk#17000 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug severity:medium triage:confirmed triage:reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Cotal-AI/Cotal#7440 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày