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

s3_request: fix broken requests_in_flight counter #216

Merged
merged 7 commits into from
Nov 9, 2022

Conversation

grrtrr
Copy link
Contributor

@grrtrr grrtrr commented Sep 27, 2022

This fixes a bug in computing the exact requests-in-flight.

These were not decremented in some case, due to the client field being NULL when the request was destroyed.

Instead of decrementing num_requests_in_flight and scheduling follow-on work when the request is destroyed,
perform this task when calling aws_s3_meta_request_finished_request (which signals that the request is done
and will not be retried), using a wrapper function.

Issue #, if available: Resolves #214

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

@DmitriyMusatkin
Copy link
Contributor

Cancel tests seem to sporadically fail after this change. Im guessing this is due to removal of s_s3_client_schedule_process_work_synced call, which results in cancel not wrapping up pending requests in some cases.

@grrtrr
Copy link
Contributor Author

grrtrr commented Nov 1, 2022

Cancel tests seem to sporadically fail after this change. Im guessing this is due to removal of s_s3_client_schedule_process_work_synced call, which results in cancel not wrapping up pending requests in some cases.

@DmitriyMusatkin - that is correct. My suggested implementation in #214 was short-sighted and buggy, since it only decreased the num_requests_in_flight after a connection was made (in aws_s3_client_notify_connection_finished).

The condition was not handled in aws_s3_client_update_connections_threaded and s_s3_client_prepare_callback_queue_request, and so failing to update cancelled requests.

I will update the notes in #214 and submit an update to this PR after some more testing.

grrtrr and others added 5 commits November 1, 2022 08:58
…mpletion (awslabs#217)

**Issue**:
If a function was called on a meta-request after it completed, this would lead to a crash (this affected `aws_s3_meta_request_increment_read_window()`, `aws_s3_meta_request_cancel()`, and `aws_s3_meta_request_pause()`)

Since these functions might be called from different threads than the thread that completes the meta-request, it would be nearly impossible for a customer to avoid these crashes.

**Description of changes:**
The reason for the crash was that the `meta_request->client` pointer would get cleared when the meta-request completed.

To fix this bug, we stop clearing this pointer early, and keep`meta_request->client` pointer valid for the lifetime of the meta-request.

We evaluated doing something much more complex (checking state and toying with reference counts before scheduling work on the client) but it seemed finicky and error-prone.
Issue #, if available:

  -  CRT S3 client doesn’t allow to config the checksum location, it will be always set to the trailer and the current API doesn't support the decision of checksum location
   - CRT S3 client doesn't support sse-c with flexible checksum, refer to here

Description of changes:

  -  Changed the API for flexible checksum
  -  Fixed the copy of the header for sse-c
- Support list of checksum algorithms to validate
- Changed the behavior that:
   - When all the parts of the object checksum have been validated, we still tell user that we did not validate the checksum
   - When some part of the object checksum validation failed, we tell user checksum validation failed, but we did not validate the checksum.


TODO: 
- Tests for checksum validation failed. <- We don't have mock server, we cannot control that...
@DmitriyMusatkin DmitriyMusatkin merged commit f94f77d into awslabs:main Nov 9, 2022
@grrtrr grrtrr deleted the issue_214 branch November 9, 2022 18:47
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.

s3_request: num_requests_in_flight not reduced due to nil client field
4 participants