Commit c0c8ce80a88 for nodejs
commit c0c8ce80a881a76485370d548fb10643f68fe670
Author: Paul Bouchon <mail@bitpshr.net>
Date: Fri Oct 16 08:44:49 2026 -0400
doc: warn against awaiting replies in module hooks
Awaiting a reply from the registering thread inside a resolve or load
hook deadlocks: resolution is synchronous from that thread's
perspective, so it is blocked in the request and cannot answer.
Fixes: https://github.com/nodejs/node/issues/63085
Signed-off-by: Paul Bouchon <mail@bitpshr.net>
PR-URL: https://github.com/nodejs/node/pull/65590
Reviewed-By: Jacob Smith <jacob@frende.me>
diff --git a/doc/api/module.md b/doc/api/module.md
index a4f83a812f9..0bd825d9040 100644
--- a/doc/api/module.md
+++ b/doc/api/module.md
@@ -1282,6 +1282,13 @@ register('./my-hooks.mjs', {
});
```
+A hook can send messages to the thread that registered it at any time, as
+above. It must not block on a reply from that thread: resolution and loading
+are synchronous from the perspective of the thread that triggered them, so that
+thread is blocked until the hook settles and cannot answer in the meantime.
+Hooks can otherwise be fully asynchronous; it is only a reply over this
+message channel that cannot be awaited.
+
#### Asynchronous hooks accepted by `module.register()`
<!-- YAML