Closed depthwise closed 3 years ago
@depthwise , Yea it looks like you are right and we need to take a closer look at this... in the mean time and just for the sake of completion, can you show me a code snippet on how you are initializing the S3Clients ?
@depthwise I am sorry I think I may have misunderstood the point of the bug report initially, but when we say the s3 client is thread safe, we mean that the same s3client can be used to do multiple requests in parallel. I would really need to see sample code for me to replicate and see if this is really a bug.
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.
Folks, I have zero interest in helping you fix your software beyond the information I already provided. I've reported the issue months ago in exhaustive detail. The repro is trivial: spin up several threads and simultaneously initialize separate client instances in them. We've patched this in our own copy of your code. This took at most 10 minutes to diagnose and fix. If, instead, you prefer to treat the problem as though it doesn't exist, that's fine. It demonstrably does exist though, as the stack trace posted in the original bug report should show to anyone who knows anything at all about concurrency.
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.
If someone else is reading this old issue and finds it concerning.
Although it technically is a thread problem, the AWS SDK fulfills the requirement to be thread safe as described in https://github.com/DaveGamble/cJSON#thread-safety. Specifically cJSON_GetErrorPtr
is not called so the not protected global_error
variable is only written to and never read.
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug If you attempt to create 2 or more S3 clients from within parallel threads in a binary instrumented with Thread Sanitizer, you will discover that initialization of S3 client accesses a global variable without synchronization while parsing JSON somewhere. Here's the relevant part of the call stack:
Other TSAN output suggests that "Location is global 'global_error' of size 16 at 0x7fe93658a1b0 (libexternal_Saws_Slibaws.so+0x0000007dc1b0)" is to blame.
266 suggests that S3 client is thread safe. The call stack shown above confirms that's not the case.
SDK version number
1.7.336
Platform/OS/Hardware/Device Ubuntu 20.04
To Reproduce (observed behavior) Spin up a few
std::thread
s and try initializing S3 clients in them in parallel in a test instrumented with TSAN. Get the stack trace above.Expected behavior If it's thread safe, it should not fail TSAN. Either eliminate that global variable, or access it while holding a global mutex lock. TSAN is used by many to improve thread safety of their code.
Logs/output If applicable, add logs or error output.
To enable logging, set the following system properties:
REMEMBER TO SANITIZE YOUR PERSONAL INFO
Additional context Add any other context about the problem here.