[Proxool-developer] concurrency bug in Prototyper class?
UNMAINTAINED!
Brought to you by:
billhorsman
From: Matt S. <msa...@gm...> - 2009-06-19 17:28:28
|
It seems Class Prototyper should either acquire the lock on private member 'lock' whenever it reads or modifies 'connectionCount' or make 'connectionCount' a volatile variable. Prototyper.buildConnection( ) acquires the lock to read and modify 'connectionCount' but other methods do not: Prototyper.sweep( ), Prototyper.connectionRemoved( ) and Prototyper.getConnectionCount(). I started poking around after my application started seeing ProxoolExceptions indicating the maximum connection count had been reached and discovered what appears to be a memory visibility issue. If calls to Prototyper.connectionRemoved( ) and Prototyper.buildConnection( ) happen in different threads there could be unwarranted ProxoolExceptions for reaching the maximum connection count - a 'connectionPool' decrement might not be visible to the threads calling Prototyper.buildConnection( ). |