Skip to content

Handle trying to stop nginx which is already shutting down - #23

Open
CamJN wants to merge 1 commit into
FooBarWidget:mainfrom
CamJN:patch-1
Open

CamJN wants to merge 1 commit into
FooBarWidget:mainfrom
CamJN:patch-1

Conversation

@CamJN

@CamJN CamJN commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Added handling for Errno::ECONNRESET, while trying to stop a daemon.

#connect already treats ECONNRESET as "can't connect" (per ALLOWED_CONNECT_EXCEPTIONS and the #connect docs). Before this change, ping_socket was an exception to the pattern.

ping_socket also runs while start waits for the daemon to come up. The same reset there would previously have crashed start instead of letting it retry.

Motivation: DaemonController#stop treats Nginx as stopped once its PID file is gone. Nginx deletes its PID file before it closes its listening sockets. So stop can return while the port is still accepting connections.

As-is daemon_controller connects without blocking, and the connection lands in the listen backlog ( EINPROGRESS). Nginx then closes the listening socket, which resets any connection still waiting in the backlog. The second connect_nonblock raises ECONNRESET.

Added handling for Errno::ECONNRESET in daemon_controller.

Signed-off-by: Camden Narzt <6243207+CamJN@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant