Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the Error Before Any Side Effects #619

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Cache the Error Before Any Side Effects #619

merged 2 commits into from
Jan 25, 2024

Conversation

waahm7
Copy link
Contributor

@waahm7 waahm7 commented Jan 24, 2024

Description of changes:

  • Cache the error before doing any cleanup to avoid any potential side effects on the error code. We found that in some cases, the exisiting approach was leading to a bogus error, AWS_ERROR_PRIORITY_QUEUE_EMPTY, when we failed in aws_event_loop_run while doing pthread_create.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@waahm7 waahm7 changed the title Cache the Error before Potential Side Effects Cache the Error Before Any Side Effects Jan 24, 2024
on_error:
on_error:;
/* cache the error code to prevent any potential side effects */
int cached_error_code = aws_last_error();

aws_mem_release(alloc, usable_cpus);
s_aws_event_loop_group_shutdown_sync(el_group);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is one of those throwing some new error because it cant clean up correctly? should we fix that as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's code in here that loops through a priority list until it raises the AWS_ERROR_PRIORITY_QUEUE_EMPTY, indicating it's empty.

So it's not an error-as-fail, it's an error-code-as-flow-control

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (6225ebb) 80.09% compared to head (d3f19b4) 80.06%.

Files Patch % Lines
source/event_loop.c 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
- Coverage   80.09%   80.06%   -0.03%     
==========================================
  Files          28       28              
  Lines        5943     5945       +2     
==========================================
  Hits         4760     4760              
- Misses       1183     1185       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -165,12 +165,16 @@ static struct aws_event_loop_group *s_event_loop_group_new(

return el_group;

on_error:
on_error:;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; _ ;

@waahm7 waahm7 merged commit 0b03c30 into main Jan 25, 2024
33 checks passed
@waahm7 waahm7 deleted the fix-bogus-error branch January 25, 2024 00:21
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.

4 participants