Closed grrtrr closed 2 years ago
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
merged, thanks for the contribution!
Describe the bug
This was found when running unit tests with the clang thread sanitizer.
Expected Behavior
Clean shutdown, no race conditions.
Current Behavior
We saw the following race condition(s):
This is equally present in
PutObjectAsync
andGetObjectAsync
, due to the same construction.The problem is that (using
GetObject
as an example), thefinish_callback
is set in the options :The options are then passed to
aws_s3_client_make_meta_request
, which returns a populatedrawRequest
.However, before the last line can be executed after
aws_s3_client_make_meta_request
returns, thefinish_callback
may already have been invoked, trying to release arawRequest
that is still set to thenullptr
value:When
userData->underlyingS3Request
has not been set (nullptr
value afternew
allocation), the call toaws_s3_meta_request_release
becomes a no-op:Back in
GetObjectAsync
,aws_s3_client_make_meta_request
returns a meta request with a non-zero reference count which, as a result of the race condition, may never be decremented.This can cause programs to hang at shutdown, which is what we are currently observing.
Reproduction Steps
Run unit tests under
clang11
using the thread sanitizer.Possible Solution
The
userData
struct needs a mutex to protect concurrent access to theaws_s3_client_make_meta_request
.Additional Information/Context
No response
AWS CPP SDK version used
1.9.x (1.9.170, but problem still exists on master).
Compiler and Version used
clang 11
Operating System and version
Linux, ubuntu 18.04