Skip to content

Conversation

@deanlee
Copy link
Contributor

@deanlee deanlee commented Dec 2, 2025

Fixes a bug in ipc_sendrecv_with_fds where a clean peer shutdown (EOF) was not handled.

  • recvmsg() == 0 → peer closed the socket cleanly (EOF). (example close(fd) or shutdown(fd, SHUT_WR))
  • recvmsg() == -1 with errno == ECONNRESET → connection reset unexpectedly (peer process crashed | TCP-level reset).

Details:

  • When the server closes the UNIX socket cleanly, recvmsg() returns 0 to indicate EOF.
  • Previous code did not handle this case, proceeding to process control messages from an empty connection.
  • This could cause VisionIpcClient::connect to return true even though no valid data was received.
  • The fix explicitly checks for r == 0 and handles peer shutdown gracefully.

This is a correctness/robustness fix; it can cause crashes or undefined behavior in some situations if not handled.

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