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

Improve cleanup of unclosed resources like connections [JDBC214] #263

Closed
firebird-automations opened this issue Dec 24, 2011 · 6 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

Relate to JDBC291
Relate to JDBC207

Bad connection management by the user could leave too many connections open or for too long. In CORE3671 this resulted in an AV in Firebird embedded (due to a problem in embedded), in other cases it can result in a number of error 10054 (windows) or 104 (Linux) (connection reset by peer) in the firebird log.

It would be a good idea to have some additional cleanup of unclosed resources by the driver. Potential ideas:
* Using PhantomReference (or something similar) to track FBConnection and destroy the associated FBManagedConection when the Connection goes out of scope
* Adding a shutdown hook to close connections that weren't closed before shutdown (potentially risky, might clash with suggestion below for JavaEE)
* Adding a ServletContainerInitializer (for servlet 3.0) to 1) close remaining connections and 2) unregister the driver (see also http://stackoverflow.com/questions/8514725/getting-a-timer-in-a-javaee-friendly-way-that-works-on-javase-too-for-use-in-a ) and/or add means for a developer to get Jaybird to cleanup (eg for pre-servlet 3.0)
* Provide logging when unclosed resources are forcefully closed by the cleanup

There is also a need to review the locations where Jaybird creates threads and eliminate that as much as possible eg by replacing those with a single-threaded ScheduledExecutorService. I believe that most of the additional threads are created in the org.firebirdsql.pool package and part of that package is getting removed in 2.3 (the connection pools; see JDBC93 and related issues), so this might be less important.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue relate to JDBC291 [ JDBC291 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue relate to JDBC207 [ JDBC207 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

assignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

A significant number of changes have been made to make this better, however the ideas like providing a servlet hook or other system of closing connections is too brittle (and easy to abuse). I might revisit this in the future.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

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

No branches or pull requests

2 participants