Properly checking the return value of ipc_sendrecv_with_fds #624
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses an issue where the VIPC server closes the socket if the required stream type is unavailable:
msgq/msgq/visionipc/visionipc_server.cc
Lines 136 to 140 in 23cb05a
This causes the
ipc_sendrecv_with_fds
function in the VIPC client to return 0. However, the client does not properly handle this error and instead relies on two assertions that are always true:msgq/msgq/visionipc/visionipc_client.cc
Lines 56 to 59 in 23cb05a
This PR introduces a proper check to ensure that the return value of
ipc_sendrecv_with_fds
is correctly handled if it is less than or equal to 0. These changes resolve the following bugs:1. Assertion in getAvailableStreams
the vipc client still can connect to the ipc path even if the camerad is not running. This could be due to the camerad not shutting down properly and the ipc path not being removed.
ipc_sendrecv_with_fds
will returns -1 In this case. this causes the following assertion to fail.This bug can be reproduced by clicking “preview driver camera" button quickly and continuously in the UI interface.
2. vipcClient:connect will returns true even if an attempt is made to connect to a non-existent stream type
the ipc_sendrecv_with_fds will return 0 if required stream type is not available. return false in this case.
This bug can be reproduced by run
watch3,
and runreplay --demo
. quit replay after the road camera displayed in watch3. and runreplay --demo --ecam --dcam
. the watch3 will assert and quit:3. crash in VideoWidget::vipcAvailableStreamsUpdated: