Jaybird 5. Rollback not completed, state was ROLLING_BACK

24 views
Skip to first unread message

Hugo Larson

unread,
Jul 28, 2026, 4:14:34 PMJul 28
to Firebird-java
Hi,

We recently upgraded to Jaybird 5 (from 4) and have since then seen the phenomenon.
No further trance is printed.
What can the reason be?

Thanks,
Hugo

org.firebirdsql.gds.ng.wire.version10.V10Transaction [Finalizer|]:org.firebirdsql.logging.JulLogger warn Rollback not completed, state was ROLLING_BACK; see debug level for stacktrace 

Mark Rotteveel

unread,
Jul 28, 2026, 5:26:04 PMJul 28
to firebi...@googlegroups.com
On 28-07-2026 22:14, 'Hugo Larson' via firebird-java wrote:
> Hi,
>
> We recently upgraded to Jaybird 5 (from 4) and have since then seen the
> phenomenon.
> No further trance is printed.
> What can the reason be?
>
> Thanks,
> Hugo
>
> *org.firebirdsql.gds.ng.wire.version10.V10Transaction
> [Finalizer|]:org.firebirdsql.logging.JulLogger warn Rollback not
> completed, state was ROLLING_BACK; see debug level for stacktrace *

Enable debug level logging and it will also log the stacktrace where
this occurred.

Given this seems to have been logged from the finalizer thread, this is
probably a transaction that was still active when the connection was
closed. The finalizer eventually tries to roll it back, but the
connection is probably already gone at that point, throwing an
exception, resulting in that log.

Unfortunately, the finalizer doesn't log the actual exception that
triggered this, just the unexpected state after the rollback attempt.
The finalizer was removed in Jaybird 6 when I removed finalization (in
some limited cases replacing it with a cleaner).

The cause might be a connection leak in your application (not closing it
before it becomes garbage), because connection finalization happens on a
level that doesn't track transactions, so if that finalizer is called
before the transaction finalizer, the connection will be gone before the
rollback happened (on connection close, the server will roll back active
transactions anyway).

I'll see if maybe I should just get rid of that finalizer in Jaybird 5
as well, but I'll first try to see if I might be losing a transaction
somewhere internally in Jaybird itself.

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 29, 2026, 12:03:39 AMJul 29
to firebi...@googlegroups.com
Hi
Yes good idea to remove finalize.

Also Firebird engine has parameter to drop limbo connections.

Thx
Hugo
--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Jul 29, 2026, 3:34:09 AMJul 29
to firebi...@googlegroups.com
On 29-07-2026 06:03, 'Hugo Larson' via firebird-java wrote:
> Hi
> Yes good idea to remove finalize.

You could also migrate to Jaybird 6, where this was already done (but
the you need to be on Java 17 or higher).

> Also Firebird engine has parameter to drop limbo connections.

I'm not aware of such a parameter, only a gfix option to resolve them,
or reattach them to a connection and then commit or rollback (which
Jaybird supports for XA).

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 29, 2026, 3:54:52 AMJul 29
to 'Mark Rotteveel' via firebird-java
Hi,

Unfortunately we are stuck with java 8.

There is this parameter in firebird.conf. Maybe it's not same thing.

# ----------------------------
# Set number of minutes after which idle attachment will be disconnected by the
# engine. Zero means no timeout is set.
#
# Per-database configurable.
#
# Type: integer
#
#ConnectionIdleTimeout = 0


--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Jul 29, 2026, 3:59:36 AMJul 29
to firebi...@googlegroups.com
On 29-07-2026 09:54, 'Hugo Larson' via firebird-java wrote:
> There is this parameter in firebird.conf. Maybe it's not same thing.
>
> # ----------------------------
> # Set number of minutes after which idle attachment will be disconnected
> by the
> # engine. Zero means no timeout is set.
> #
> # Per-database configurable.
> #
> # Type: integer
> #
> #ConnectionIdleTimeout = 0

That parameter controls how long a connection may be idle (i.e. not
receive requests from the client), it's not related to transactions
(though, when a connection is terminated, any active transactions are
rolled back, but it doesn't affect limbo transactions).

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 29, 2026, 4:05:06 AMJul 29
to 'Mark Rotteveel' via firebird-java
"
 I'll first try to see if I might be losing a transaction
somewhere internally in Jaybird itself.
"
It could be the case because we se this problem daily at sites that are upgraded to jaybird 5 (from 4). 

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Jul 29, 2026, 4:58:06 AMJul 29
to firebi...@googlegroups.com
On 29-07-2026 10:05, 'Hugo Larson' via firebird-java wrote:
> "
>  I'll first try to see if I might be losing a transaction
> somewhere internally in Jaybird itself.
> "
> It could be the case because we se this problem daily at sites that are
> upgraded to jaybird 5 (from 4).

Yes, and this finalizer and the logging of invalid state was already
present in Jaybird 4, so that would seem to point to something in

Mark Rotteveel

unread,
Jul 29, 2026, 7:23:33 AMJul 29
to firebi...@googlegroups.com
On 28-07-2026 22:14, 'Hugo Larson' via firebird-java wrote:
> We recently upgraded to Jaybird 5 (from 4) and have since then seen the
> phenomenon.
> No further trance is printed.
> What can the reason be?

Could you enable debug logging on
org.firebirdsql.gds.ng.AbstractFbAttachment?

I suspect it'll log "Exception on safely detach" with an exception with
message "cannot disconnect database with open transactions ({0} active)"
(where the {0} is probably 1).

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 29, 2026, 8:06:06 AMJul 29
to 'Mark Rotteveel' via firebird-java
Mark,

Need to ask you a dumb question. How to enable logging?
Create a file jaybird-logging.properties?

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Jul 29, 2026, 9:34:31 AMJul 29
to firebi...@googlegroups.com
On 29-07-2026 14:06, 'Hugo Larson' via firebird-java wrote:
> Mark,
>
> Need to ask you a dumb question. How to enable logging?
> Create a file jaybird-logging.properties?

By default, java.util.logging is used, and if you have no explicit
java.util.logging configuration, it uses the JVM default config (in
%JAVA_HOME%/conf/logging.properties).

See for example this tutorial:
https://mkyong.com/logging/java-logging-apis-tutorial/

As a small example, create a logging.properties file with contents
(without the backticks):

```
handlers = java.util.logging.ConsoleHandler
# Set root logger to WARNING and higher
.level = WARNING
# Set org.firebirdsql logger to INFO and higher
org.firebirdsql.level = INFO
# Set org.firebirdsql.gds.ng.AbstractFbAttachment logger to FINE
org.firebirdsql.gds.ng.AbstractFbAttachment.level = FINE
# Set org.firebirdsql.gds.ng.wire.version10.V10Transaction logger to FINE
org.firebirdsql.gds.ng.wire.version10.V10Transaction.level = FINE

# Configure handler to output FINE
java.util.logging.ConsoleHandler.level = FINE
```

(JUL level FINE corresponds to what Jaybird 5 calls debug level)

The use of the ConsoleHandler will log to the standard error output.

Then run your application with
`-Djava.util.logging.config.file=/path/to/logging.properties` (replace
/path/to with actual path or relative path from the current working
directory).

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 29, 2026, 10:31:30 AMJul 29
to 'Mark Rotteveel' via firebird-java
Is this helpful?
Everytime all the time 

26-07-29 16:28:54|org.firebirdsql.gds.ng.AbstractFbAttachment [Finalizer|]:org.firebirdsql.logging.JulLogger debug Exception on safely detach 
java.sql.SQLException: Error writing data to the connection. [SQLState:08006, ISC error code:335544727]
at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:618)
at org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:571)
at org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:309)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:201)
at org.firebirdsql.gds.ng.AbstractFbDatabase.close(AbstractFbDatabase.java:190)
at org.firebirdsql.gds.ng.AbstractFbAttachment.safelyDetach(AbstractFbAttachment.java:176)
at org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.finalize(AbstractFbWireDatabase.java:372)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:199)



--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Hugo Larson

unread,
Jul 29, 2026, 10:38:03 AMJul 29
to 'Mark Rotteveel' via firebird-java
Three exeptions.

26-07-29 16:28:53|org.firebirdsql.gds.ng.wire.version13.V13WireOperations [Thread-7|]:org.firebirdsql.logging.JulLogger debug Could not load EncryptionPluginSpi: org.firebirdsql.gds.ng.wire.crypt.chacha.ChaChaEncryptionPluginSpi 
java.lang.ClassNotFoundException: org.firebirdsql.gds.ng.wire.crypt.chacha.ChaChaEncryptionPluginSpi
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.firebirdsql.gds.ng.wire.version13.V13WireOperations.<clinit>(V13WireOperations.java:77)
at org.firebirdsql.gds.ng.wire.version19.Version19Descriptor.createWireOperations(Version19Descriptor.java:127)
at org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.<init>(AbstractFbWireDatabase.java:63)
at org.firebirdsql.gds.ng.wire.version10.V10Database.<init>(V10Database.java:68)
at org.firebirdsql.gds.ng.wire.version11.V11Database.<init>(V11Database.java:54)
at org.firebirdsql.gds.ng.wire.version12.V12Database.<init>(V12Database.java:55)
at org.firebirdsql.gds.ng.wire.version13.V13Database.<init>(V13Database.java:47)
at org.firebirdsql.gds.ng.wire.version15.V15Database.<init>(V15Database.java:44)
at org.firebirdsql.gds.ng.wire.version16.V16Database.<init>(V16Database.java:44)
at org.firebirdsql.gds.ng.wire.version18.V18Database.<init>(V18Database.java:43)
at org.firebirdsql.gds.ng.wire.version19.V19Database.<init>(V19Database.java:54)
at org.firebirdsql.gds.ng.wire.version19.Version19Descriptor.createDatabase(Version19Descriptor.java:64)
at org.firebirdsql.gds.ng.wire.WireDatabaseConnection.createConnectionHandle(WireDatabaseConnection.java:90)
at org.firebirdsql.gds.ng.wire.WireDatabaseConnection.createConnectionHandle(WireDatabaseConnection.java:36)
at org.firebirdsql.gds.ng.wire.WireConnection.identify(WireConnection.java:382)
at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.performConnect(FbWireDatabaseFactory.java:51)
at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.connect(FbWireDatabaseFactory.java:39)
at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.connect(FbWireDatabaseFactory.java:32)
at org.firebirdsql.jaybird.xca.FBManagedConnection.<init>(FBManagedConnection.java:121)
at org.firebirdsql.jaybird.xca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:375)
at org.firebirdsql.jaybird.xca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:48)
at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:72)
at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:137)
___________________________________________________________________________________________________________________________________________________
26-07-29 16:28:53|org.firebirdsql.gds.ng.AbstractFbAttachment [Finalizer|]:org.firebirdsql.logging.JulLogger debug Exception on safely detach 
java.sql.SQLException: Error writing data to the connection. [SQLState:08006, ISC error code:335544727]
at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:618)
at org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:571)
at org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:309)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:201)
at org.firebirdsql.gds.ng.AbstractFbDatabase.close(AbstractFbDatabase.java:190)
at org.firebirdsql.gds.ng.AbstractFbAttachment.safelyDetach(AbstractFbAttachment.java:176)
at org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.finalize(AbstractFbWireDatabase.java:372)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:199)
... 7 more
____________________________________________________________________________________________________________________________________________________
26-07-29 16:28:54|org.firebirdsql.gds.ng.AbstractFbAttachment [Finalizer|]:org.firebirdsql.logging.JulLogger debug Exception on safely detach 
java.sql.SQLException: Error writing data to the connection. [SQLState:08006, ISC error code:335544727]
at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:618)
at org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:571)
at org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:309)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:201)
at org.firebirdsql.gds.ng.AbstractFbDatabase.close(AbstractFbDatabase.java:190)
at org.firebirdsql.gds.ng.AbstractFbAttachment.safelyDetach(AbstractFbAttachment.java:176)
at org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.finalize(AbstractFbWireDatabase.java:372)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.firebirdsql.gds.ng.wire.version10.V10Database.internalDetach(V10Database.java:199)


--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Hugo Larson

unread,
Jul 29, 2026, 10:45:25 AMJul 29
to 'Mark Rotteveel' via firebird-java
Attached full file.

On Wednesday, July 29, 2026 at 01:23:35 PM GMT+2, 'Mark Rotteveel' via firebird-java <firebi...@googlegroups.com> wrote:


jaybird.log

Mark Rotteveel

unread,
Jul 30, 2026, 4:32:37 AMJul 30
to firebi...@googlegroups.com
On 29-07-2026 16:37, 'Hugo Larson' via firebird-java wrote:
> Three exeptions.
>
> 26-07-29 16:28:53|
> org.firebirdsql.gds.ng.wire.version13.V13WireOperations
> [Thread-7|]:org.firebirdsql.logging.JulLogger debug Could not load
> EncryptionPluginSpi:
> org.firebirdsql.gds.ng.wire.crypt.chacha.ChaChaEncryptionPluginSpi
> java.lang.ClassNotFoundException:
> org.firebirdsql.gds.ng.wire.crypt.chacha.ChaChaEncryptionPluginSpi


This one is expected (once per JVM/classloader hierarchy) on Java 8 (see
https://github.com/FirebirdSQL/jaybird/blob/e4526d8ece9c8e8d5c895015e83b6dbcc44ae441/src/main/org/firebirdsql/gds/ng/wire/version13/V13WireOperations.java#L82-L86)
The finalizer attempts to close it, but the socket was already closed.
This one is a bit odd, because it does check if the socket is still open
in the finalizer and otherwise doesn't attempt to close. I wonder if
this might be some kind of race condition or visibility problem.

____________________________________________________________________________________________________________________________________________________
> 26-07-29 16:28:54|org.firebirdsql.gds.ng.AbstractFbAttachment
> [Finalizer|]:org.firebirdsql.logging.JulLogger debug Exception on safely
> detach
> java.sql.SQLException: Error writing data to the connection.
> [SQLState:08006, ISC error code:335544727]

This one is the same as the previous one. I guess you intended to copy:

```
26-07-29
16:39:21|org.firebirdsql.jaybird.xca.FBStandAloneConnectionManager
[Finalizer|]:org.firebirdsql.logging.JulLogger debug Exception closing
unmanaged connection:
java.sql.SQLException: No connection established to the database server
[SQLState:08003, ISC error code:337248273]
at
org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:618)
at
org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:571)
at
org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:309)
at
org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.checkConnected(AbstractFbWireDatabase.java:135)
at
org.firebirdsql.gds.ng.AbstractFbDatabase.close(AbstractFbDatabase.java:175)
at org.firebirdsql.gds.impl.GDSHelper.detachDatabase(GDSHelper.java:163)
at
org.firebirdsql.jaybird.xca.FBManagedConnection.destroy(FBManagedConnection.java:358)
at
org.firebirdsql.jaybird.xca.FBStandAloneConnectionManager.connectionClosed(FBStandAloneConnectionManager.java:57)
at
org.firebirdsql.jaybird.xca.FBManagedConnection.notify(FBManagedConnection.java:1081)
at
org.firebirdsql.jaybird.xca.FBManagedConnection.close(FBManagedConnection.java:995)
at org.firebirdsql.jdbc.FBConnection.closeMc(FBConnection.java:479)
at org.firebirdsql.jdbc.FBConnection.close(FBConnection.java:451)
at com.borland.dx.sql.dataset.Database.closeConnection(Database.java:423)
at com.borland.dx.sql.dataset.Database.finalize(Database.java:1053)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217)
```

Here, it is the finalizer of com.borland.dx.sql.dataset.Database that
closes the connection, but the underlying physical connection was
already closed (probably by the finalizer).

---

It seems to be a connection leak in your application, and then
finalizers running in an indeterminate order, meaning sometimes
underlying objects are already finalized while a dependent object
expects it to be still there and not yet finalized/closed for their
finalization (possibly with a race condition or thread visibility
issue). Combined with that "Rollback not completed" warning, it also
means that you leak connections with an active transaction (i.e. didn't
explicitly commit or rollback). If these are transactions modifying
data, you might be losing data.

I guess that your code needs to explicitly close instances of
com.borland.dx.sql.dataset.Database. (Maybe in a finally explicitly call
its closeConnection() method or some other close method?)

The fact that you now see those "Rollback not completed" warnings in
Jaybird 5 compared to Jaybird 4 is likely given the change from
synchronized to ReentrantLock objects, and some other thread-safety
changes I made. I guess I have removed something that previously
established a happens-before relation, causing some checks to
incorrectly pass now while they previously failed (and then maybe caused
an exception that would be ignored somewhere or even thrown out to the
finalizer thread).

In short, make sure you actually close your
com.borland.dx.sql.dataset.Database instances.

In the meantime, I'll see if I shouldn't just get rid of some of those
finalizers (e.g. in practice, transactions are only eligible for GC if
the connection is eligible for GC, so finalizing them seems to be
unnecessary busy-work), and I'll try to track down and fix the apparent
thread-safety issue.

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Jul 30, 2026, 4:51:07 AMJul 30
to firebi...@googlegroups.com
On 30-07-2026 10:32, 'Mark Rotteveel' via firebird-java wrote:
> In the meantime, I'll see if I shouldn't just get rid of some of those
> finalizers (e.g. in practice, transactions are only eligible for GC if
> the connection is eligible for GC, so finalizing them seems to be
> unnecessary busy-work), and I'll try to track down and fix the apparent
> thread-safety issue.

Issue: https://github.com/FirebirdSQL/jaybird/issues/953

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Jul 30, 2026, 6:44:38 AMJul 30
to 'Mark Rotteveel' via firebird-java
Great will do and wait for a new Jaybird build.

Thanks! 

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Jul 31, 2026, 7:49:30 AMJul 31
to firebi...@googlegroups.com
On 30-07-2026 10:32, 'Mark Rotteveel' via firebird-java wrote:
> In the meantime, I'll see if I shouldn't just get rid of some of those
> finalizers (e.g. in practice, transactions are only eligible for GC if
> the connection is eligible for GC, so finalizing them seems to be
> unnecessary busy-work), and I'll try to track down and fix the apparent
> thread-safety issue.

I've made some changes to address the obvious failure modes. I'll need
to make another pass to see if there are further improvements possible.

You can check jaybird 5.0.13.java8-SNAPSHOT on the Sonatype OSS snapshot
repository.

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Aug 1, 2026, 5:26:13 AMAug 1
to 'Mark Rotteveel' via firebird-java
Hi,

Tried the new but there seems to be same exceptions in log.
Attached it.

BR,
Hugo

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.
jaybird.zip

Mark Rotteveel

unread,
Aug 1, 2026, 5:36:57 AMAug 1
to firebi...@googlegroups.com
On 01-08-2026 11:26, 'Hugo Larson' via firebird-java wrote:
> Tried the new but there seems to be same exceptions in log.
> Attached it.


The changes I did in the snapshot were primarily related to that
transaction finalization issue and resulting "Rollback not completed"
warning log.

The exception on close that is logged on debug (FINE) level due to your
connection leak I'm not sure I can prevent, because it looks like the
socket gets closed by a different finalizer thread concurrently _after_
Jaybird checks if that socket is still open. However, I'm still looking
into that.

Maybe I should just get rid of that finalizer entirely (which is also
what I did in Jaybird 6), and not even try to do a clean close in that case.

That said, the best course of action is probably for you to fix the
connection leak by closing that Database instance.

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Aug 3, 2026, 12:58:21 AMAug 3
to 'Mark Rotteveel' via firebird-java
Understood.

I suspect there is an threading issue with Jaybird since the start.
With my ancient library  I get often one of these exceptions.

"The result set is closed", "connection shutdown", "This connection is closed and cannot be used now", "no transaction for request", "Connection closed or no connection available"

//BR

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.

Mark Rotteveel

unread,
Aug 4, 2026, 2:59:19 AMAug 4
to firebi...@googlegroups.com
On 03-08-2026 06:58, 'Hugo Larson' via firebird-java wrote:
> Understood.
>
> I suspect there is an threading issue with Jaybird since the start.
> With my ancient library  I get often one of these exceptions.
>
> "The result set is closed", "connection shutdown", "This connection is
> closed and cannot be used now", "no transaction for request",
> "Connection closed or no connection available"

Possibly, though most of the operations of Jaybird or protected by a
lock. However, even in that case, if you use a single connection from
multiple threads concurrently, you can run into problems. If you have a
reproducible case (preferably an artificial one), I'll be happy to
investigate.

However, some of those errors have some common causes:

"The result set is closed"
* Attempt to execute another statement on a `Statement` while still
trying to use the result set from the previous execution on that `Statement`
* Attempt to execute another statement in auto-commit mode, while trying
to use the result set produced by another `Statement` of that same
`Connection`
* If multiple threads use the same connection concurrently, it might
even be easier to cause this unknowingly

Especially for this error, I would take a closer look at that Borland
library, because these are especially the things older JDBC
specifications were less clear about, and where actual behaviour can
vary wildly between drivers.

"connection shutdown"
* Reported by the server if the database was shutdown with gfix (or
FBMaintenanceManager or similar); the server might report this for other
cases as well

"This connection is closed and cannot be used now"
* Reported if the FBConnection (JDBC connection) is marked as closed.
** A connection can also get implicitly closed if Jaybird considers some
errors to be fatal (e.g. indicate a broken connection). This would
usually follow after an earlier exception

(Jaybird 6 and higher will report "The connection is closed")

"no transaction for request"
* If this is reported by the Jaybird, it means the JDBC connection is no
longer associated with a physical connection. This is pretty much the
same error as previous, but would only happens if either a validity
check is missing, or if the connection was broken during an operation.
** To be clear, this is pretty much the "wrong" error message, but as
it's been used for a very long time in Jaybird code, I haven't touched
it (yet).
** The message is used because internally Jaybird can bind and unbind
JDBC connections (or, its FBManagedConnection) on different physical
connections; however that case shouldn't occur when used as a plain JDBC
connection.
* It might also be reported by the server, and could then indicate a
Jaybird having done something wrong.

"Connection closed or no connection available"
* Reported if the socket was never opened, or is now closed. It should
only be possible for this to get reported if a connection gets broken in
the middle of an operation.

(Jaybird 6 and higher will report "The connection is closed")

These are the "normal" cases, and not if they happen during
finalization. During finalization, basically all bets are off. This is
also why in Jaybird 6 I removed some outright, without replacing them
with a cleaner. I'll see if those same cases should also be removed in
Jaybird 5.

For the last three cases, you may want to wait for Jaybird 5.0.13 and
try the Boolean system property
org.firebirdsql.jdbc.connection.forceCloseOnFatal introduced with
https://github.com/FirebirdSQL/jaybird/issues/893. When set to false,
Jaybird will not invalidate the connection if an exception occurs that
it deems fatal. That's no guarantee for a fix (it might just cause a
lower level error because the connection was indeed broken but now not
marked as closed), but sometimes the classification of errors as fatal
is wrong.

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Aug 4, 2026, 3:08:54 AMAug 4
to firebi...@googlegroups.com
On 04-08-2026 08:59, 'Mark Rotteveel' via firebird-java wrote:
> For the last three cases, you may want to wait for Jaybird 5.0.13 and
> try the Boolean system property
> org.firebirdsql.jdbc.connection.forceCloseOnFatal introduced with
> https://github.com/FirebirdSQL/jaybird/issues/893. When set to false,
> Jaybird will not invalidate the connection if an exception occurs that
> it deems fatal. That's no guarantee for a fix (it might just cause a
> lower level error because the connection was indeed broken but now not
> marked as closed), but sometimes the classification of errors as fatal
> is wrong.

Documentation:
https://firebirdsql.github.io/jaybird-manual/jaybird_manual.html#systemproperties-force-close-on-fatal
(requires Jaybird 5.0.13/6.0.6, which is not yet released)

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Aug 4, 2026, 4:31:47 AMAug 4
to firebi...@googlegroups.com
On 31-07-2026 13:49, 'Mark Rotteveel' via firebird-java wrote:
> I've made some changes to address the obvious failure modes. I'll need
> to make another pass to see if there are further improvements possible.
>
> You can check jaybird 5.0.13.java8-SNAPSHOT on the Sonatype OSS snapshot
> repository.


I published a new snapshot that has some more finalization removed or
limited.

Mark
--
Mark Rotteveel

Hugo Larson

unread,
Aug 4, 2026, 11:46:50 AMAug 4
to 'Mark Rotteveel' via firebird-java
I downloaded snapshot and in main set System.setProperty("org.firebirdsql.jdbc.connection.forceCloseOnFatal", "false");

--
Support the ongoing development of Firebird! Consider donating to the Firebird Foundation and help ensure its future. Every contribution makes a difference. Learn more and donate here:
---
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages