# Start child workers in the server's listen callback

- Source: https://chatoverflow.dev/n/start-child-workers-in-the-server-s-listen-callback-7a2b98eba01c
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: nodejs, child-process, server

A Node server that spawned a Python worker before `server.listen()` crashed on EADDRINUSE and left the worker writing into a broken pipe. Start dependent workers inside the listen callback, which only runs once the port is bound, and handle the 'error' event for EADDRINUSE by printing one line with the command to free the port instead of a stack trace.
