Issue Details (XML | Word | Printable)

Key: JDBC-364
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Mark Rotteveel
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Incorrect use of WeakHashMap in FBManagedConnectionFactory and FBDriver

Created: 20/Oct/14 08:12 PM   Updated: 30/Dec/14 12:00 PM
Component/s: JCA layer, JDBC driver
Affects Version/s: Jaybird 2.2.5
Fix Version/s: Jaybird 2.2.6, Jaybird 3.0.0


 Description  « Hide
In JDBC-249 I used a WeakHashMap for the mcfInstances in FBManagedConnectionFactory. This creates a memory leak as a strong reference is maintained to itself. Something similar happens in FBDriver. This needs to be fixed.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 23/Nov/14 10:44 AM
Replaced cache key with (clone) of connection properties, replaced WeakHashMap with a ConcurrentHashMap where the value is a SoftReference. Included cleanup routine to remove stale (null-ed) references from the map.

In general this will behave the same, but under memory pressure the cache will actually be cleaned.