Skip to content

client_msg_cb: stop dispatching messages once an error is pending - #571

Open
iefa-m wants to merge 1 commit into
sudo-project:mainfrom
iefa-m:logsrvd-stop-after-error
Open

iefa-m wants to merge 1 commit into
sudo-project:mainfrom
iefa-m:logsrvd-stop-after-error

Conversation

@iefa-m

@iefa-m iefa-m commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

client_msg_cb() handles every complete ClientMessage in the read buffer in one loop. When a RestartMessage fails, handle_restart() calls schedule_error_message() and then returns true on purpose so the error still reaches the client. The loop never looks at closure->error, though, so any messages the client sent right behind the RestartMessage are still dispatched. They run against whatever the failed restart left in the closure: log_io already set, an evlog without the I/O log files open, and possibly an open iolog_dir_fd.

Stop the loop once an error is pending. The read event is already removed at that point, so this only drops input that was going to be ignored anyway. relay_server_msg_cb() has the same loop, and handle_server_error() also returns true after scheduling an error, so it gets the same check.

handle_restart() returns true after scheduling an error so the error
can be sent to the client, but client_msg_cb() kept handling any
messages already in the read buffer.  Those ran against the state left
behind by the failed restart.  Stop the loop once closure->error is set.
relay_server_msg_cb() has the same loop and gets the same check.
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