Skip to content

Connection Manager Acquisition Timeout #479

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

Merged
merged 31 commits into from
Aug 1, 2024
Merged

Conversation

waahm7
Copy link
Contributor

@waahm7 waahm7 commented Jul 29, 2024

Description of changes:
Introduce a new pending_connections_acquire_timeout_ms similar to max_connection_idle_in_milliseconds. I have changed the s_schedule_connection_culling to a generic s_schedule_culling which culls both the idle connections and pending acquisitions.

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

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.38%. Comparing base (a2fb16c) to head (0aa91bf).

Files Patch % Lines
source/connection_manager.c 96.87% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
- Coverage   79.43%   79.38%   -0.05%     
==========================================
  Files          27       27              
  Lines       11622    11657      +35     
==========================================
+ Hits         9232     9254      +22     
- Misses       2390     2403      +13     

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

@waahm7 waahm7 changed the title WIP | Connection Manager Acquisition Timeout Connection Manager Acquisition Timeout Jul 29, 2024
@waahm7 waahm7 marked this pull request as ready for review July 29, 2024 23:30
Comment on lines 850 to 857
uint64_t cull_task_time = s_calculate_idle_connection_cull_task_time(manager);
uint64_t connection_acquire_timeout = s_calculate_pending_connections_acquire_cull_task_time(manager);

return;
if (manager->max_connection_idle_in_milliseconds != 0 && manager->pending_connections_acquire_timeout_ms != 0) {
cull_task_time = aws_min_u64(cull_task_time, connection_acquire_timeout);
} else if (manager->pending_connections_acquire_timeout_ms != 0) {
cull_task_time = connection_acquire_timeout;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need two separate helper function to get the proper time for next cull task?
it seems more complicated than it needs to be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started with one function, but it was more confusing since we need to cast the list node to different structs and check a different variable for full cull timestamp. It was the same amount of code duplication. So I split them into two separate functions.

Comment on lines 811 to 814
/*
* Since the pending acquires are in FIFO order in the list, the front of the list has the closest
* cull time.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

it's just confusing that the comments above is

        /*
         * Since the connections are in LIFO order in the list, the front of the list has the closest
         * cull time.
         */

And here, everything is the same but FIFO order to be mentioned...

I think for the acquisition it's not as complicated as the connections. It won't back to the queue after poped. So, it may be simpler to just mention that the front will be the closest cull time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated with the simple version.

AWS_FATAL_ASSERT(manager->cull_event_loop != NULL);

uint64_t cull_task_time = s_calculate_idle_connection_cull_task_time(manager);
uint64_t connection_acquire_timeout = s_calculate_pending_connections_acquire_cull_task_time(manager);
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep the naming consistent with the existing naming. acquire -> acquisition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated to what Mike suggested.

@waahm7 waahm7 merged commit 13f427b into main Aug 1, 2024
36 checks passed
@waahm7 waahm7 deleted the connection-manager-updates branch August 1, 2024 17:14
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