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

Incorrect use of WeakHashMap in FBManagedConnectionFactory and FBDriver [JDBC364] #406

Closed
firebird-automations opened this issue Oct 20, 2014 · 5 comments

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

In JDBC249 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.

Commits: a37c40e 0dddd3d 9231722 fbcced3 FirebirdSQL/fbt-repository@6ef4f5a FirebirdSQL/fbt-repository@9abaccd FirebirdSQL/fbt-repository@e798fe1 FirebirdSQL/fbt-repository@db52633

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 3.0 [ 10440 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.6 [ 10588 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

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.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment