Clean up error handling in many rcl{_action,_lifecycle} codepaths#1202
Merged
fujitatomoya merged 22 commits intorollingfrom Dec 26, 2024
Merged
Conversation
Instead of waiting 250ms between setting up 10 goals (for at least 2.5 seconds), just wait 100ms which reduces this to 1 second. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That is, if rcutils_hash_map_set() fails, it sets its own error, so overriding it with our own will cause a warning to print. Make sure to clear it before setting our own. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
This avoids a warning on cleanup in rcl_timer_init2. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Otherwise, in a failure situation we set the error but we actually return RCL_RET_OK to the upper layers, which is odd. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
This generated code was translating an RCL error to an RCL error, which doesn't make much sense. Just remove the duplicate code. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Rather than starting it enabled, and then immediately canceling it. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
It already sets the error, so rcl_action_server_goal_exists() should not set it again. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That way we avoid an ugly warning in the error paths. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That way when we go to cleanup in the "fail" case, the options actually exist and are valid. This avoids an ugly warning during cleanup. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
This makes it match the generated code for the action_client. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That way subsequent failures won't print out ugly error strings. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That is, if rcl_lexer_lookahead2_expect() returns an error, we should pass that along to higher layers rather than just ignoring it. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
It leads to ugly warnings. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Otherwise we get a warning about overwriting the error from rcutils_hash_map_init. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Only when rcl_context_is_valid doesn't set the error. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
It already sets the error in the failure case. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That's because some of the RMW implementations may not support this feature, and thus set errors. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That way we can set more useful errors for the upper layers. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
In particular, make sure to not overwrite errors as we get into error-handling paths, which should clean up warnings we get. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
That way we won't get ugly "overwritten" warnings on subsequent tests. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Contributor
Author
|
Pulls: #1202 |
Collaborator
fujitatomoya
left a comment
There was a problem hiding this comment.
lgtm, but a couple of comments.
fujitatomoya
approved these changes
Dec 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The original impetus from this PR came from running the
rcltests, and seeing output like the following on the console:There are 2 main reasons why this can happen:
rcl_reset_error()before trying another condition.This PR corrects almost all instances of this occurence in the rcl libraries, with the exception of
test_arguments, which has quite a few of these and will require a separate PR. Not only will this quite down many of the tests, it also fixes some bugs in error handling in this code.