Closed a-nickol closed 1 week ago
A workaround is probably to create a bucket for every every task, tokio worker or a pool of buckets.
This is a very old issue! but is still there. I keep hitting the same issue when try to asynchronously put/get different objects
@a-nickol 's workaround above confirmed valid.
Ended up with a struct holding Credentials, Region and the bucket name + impl bucket()
method.
I first encountered this with
.get_object_tagging()
But seems to be the same for gets and puts and such.
Describe the bug
When
rust-s3
is used withtokio
and in a concurrent setup, refreshing the credentials will result in a read or write race condition for the corresponding lock.The credentials just use the system
RwLock
.To Reproduce Just make some concurrent requests read requests:
About 1 % of the requests result in a write error
About 0,5 % of the requests result in a read error
Expected behavior No error should occur.
Environment
Possible Solution The method should be
async
and bucket should usetokio::sync::RwLock
whentokio
is used.