Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Incorrect synchronization of ConnectionPool.connectionMap #4

Closed
jakubjanecek opened this issue Jan 3, 2013 · 0 comments
Closed

Incorrect synchronization of ConnectionPool.connectionMap #4

jakubjanecek opened this issue Jan 3, 2013 · 0 comments

Comments

@jakubjanecek
Copy link

Access to field connectionMap (which is not thread-safe) in class ConnectionPool is not synchronized properly. The problem is in method createConnection where new connections are created and put into the map however more threads can access the map at once - the locking mechanism on the connection does not protect the map. We encountered the problem in production resulting in infinite loop (caused by corrupted internal state of the map).

I suggest to replace HashMap with ConcurrentHashMap.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant