Skip to content

Commit d4c6ea3

Browse files
committed
#893 jdp-2026-04: Disable closing of broken connections
1 parent d124de1 commit d4c6ea3

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
= jdp-2026-04: Disable closing of broken connections
2+
3+
// SPDX-FileCopyrightText: Copyright 2026 Mark Rotteveel
4+
// SPDX-License-Identifier: LicenseRef-PDL-1.0
5+
6+
== Status
7+
8+
* Draft
9+
* Proposed for: Jaybird 5.0.13, Jaybird 6.0.6, Jaybird 7
10+
11+
== Type
12+
13+
* Feature-Specification
14+
15+
== Context
16+
17+
Currently, Jaybird will forcibly close connections if errors occur that it considers fatal.
18+
Specifically, if `FatalErrorHelper#isFatal(SQLException)` returns true for exceptions that reach `FBManagedConnection#errorOccurred`.
19+
This close then happens in method `connectionErrorOccurred` in `FBStandAloneConnectionManager` (used for most connections created in Jaybird), and `FBXADataSource.XAConnectionManager` (used for connections created by `FBXADataSource`).
20+
21+
We have received requests to not do this and leave closing to the connection pool they're using or user code.
22+
There have also been problems with wrong classification because Firebird used the wrong SQLSTATE for some errors, and thus Jaybird unnecessarily killing the connection.
23+
24+
== Decision
25+
26+
Although we think that forcibly closing the connection in these cases is the cleanest and correct solution, we recognize that Jaybird might sometimes be wrong in its decision, or that users want more control over this.
27+
28+
As such we'll add Boolean *system* properties to control the behaviour of `FBStandAloneConnectionManager` and `XAConnectionManager`.
29+
These system properties will be checked _dynamically_ (i.e. each time their `connectionErrorOccurred` is invoked), so they can be changed at run time.
30+
31+
We think this should only be used for debugging or workarounds.
32+
Correct behaviour of a connection after such an error is ignored is not guaranteed.
33+
34+
== Consequences
35+
36+
Jaybird will add two Boolean system properties:
37+
38+
`org.firebirdsql.jdbc.connection.forceCloseOnFatal`::
39+
Configures behaviour of "`normal`" JDBC connections (i.e. created with `org.firebirdsql.jaybird.xca.FBStandAloneConnectionManager`);
40+
defaults to `true`.
41+
+
42+
We use prefix `org.firebirdsql.jdbc.connection.` because XCA is internal API, and this affects most JDBC connections (except those from `FBXADataSource`, or those created with a custom `XcaConnectionManager`).
43+
44+
`org.firebirdsql.ds.xa.connection.forceCloseOnFatal`::
45+
Configures behaviour of (XA) connections created by `org.firebirdsql.ds.FBXADataSource`;
46+
defaults to `true`.
47+
48+
If the force close is disabled, this will be logged together with the error.
49+
50+
[appendix]
51+
== License Notice
52+
53+
The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the “License”);
54+
you may only use this Documentation if you comply with the terms of this License.
55+
A copy of the License is available at https://firebirdsql.org/en/public-documentation-license/.
56+
57+
The Original Documentation is "`jdp-2026-04: Disable closing of broken connections`".
58+
The Initial Writer of the Original Documentation is Mark Rotteveel, Copyright © 2026.
59+
All Rights Reserved.
60+
(Initial Writer contact(s): mark (at) lawinegevaar (dot) nl).
61+
62+
////
63+
Contributor(s): ______________________________________.
64+
Portions created by ______ are Copyright © _________ [Insert year(s)].
65+
All Rights Reserved.
66+
(Contributor contact(s): ________________ [Insert hyperlink/alias]).
67+
////
68+
69+
The exact file history is recorded in our Git repository;
70+
see https://github.com/FirebirdSQL/jaybird

0 commit comments

Comments
 (0)