libuv handle
A libuv object representing a long-lived resource such as a timer, socket or server; while active ones remain, the event loop keeps the process alive.
In more detail
An open server, a pending timer or a connected socket each hold a handle. Calling unref() on one tells libuv not to count it when deciding whether the process may exit.
Related terms
- libuv — The C library inside Node.js that runs the event loop, performs asynchronous I/O and manages the thread pool.
- unref() and ref() — Methods on Node.js timers, sockets and servers: unref() lets the process exit even though this handle is still active, and ref() undoes that.
- uv_run — The libuv function that runs the event loop, going round its phases until no active handles or requests remain.
Taught in
- Event Loop Lifecycle: The Six Phases & libuv uv_run — Node.js Internals & Backend Services
- Timers Phase: setTimeout, Min-Heap Scheduling & Drift — Node.js Internals & Backend Services
- Close Phase & Signal Dispatch: Sockets & Teardown — Node.js Internals & Backend Services