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

Race condition in ContainerCache.getContainer #162

Open
codeperfector opened this issue Feb 6, 2019 · 0 comments
Open

Race condition in ContainerCache.getContainer #162

codeperfector opened this issue Feb 6, 2019 · 0 comments

Comments

@codeperfector
Copy link

ContainerCache uses TreeMap which is not thread-safe.

We ran into an issue in production with calls to Account.getContainer from multiple threads. This method delegates to ContainerCache.getContainer which looks up the container by name from the internal TreeMap data structure. If there is a cache miss, it creates a new Container and puts it in the TreeMap. So you can get multiple threads concurrently accessing and modifying the TreeMap which in combination with tree rebalancing can result in some bad race conditions. We saw our threads spinning in the call to retrieve a container from the TreeMap. The solution for us was to use our own caching and disable the cache in ContainerCache. However this issue needs a permanent fix.

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

No branches or pull requests

1 participant