FBPooledConnection in some kind of loop

4 views
Skip to first unread message

Fabio Luis - Vanguarda TI

unread,
Mar 5, 2026, 11:11:28 PM (14 days ago) Mar 5
to firebi...@googlegroups.com
Hi.

I have two servers, one with firebird 5.0.3 and another with many docker containers running Payara application server using jaybird 5.0.9.java8.

In some situations could be network instabilities between servers, or even a Firebird restart.

And when this happens, at least one docker container has problems with FBPooledConnection in some kind of loop.

The loop only stops when I restart the container (Payara application server).

Attached some images from the profiler can be more helpful to understand the problem.

Thanks
Fabio Silva
jaybird-loop-error-3.png
FBPooledConnection.png
jaybird-loop-error.png
jaybird-loop-error-2.png
db-classes-application-server-configuration.png

Mark Rotteveel

unread,
Mar 6, 2026, 7:01:12 AM (14 days ago) Mar 6
to firebi...@googlegroups.com
I think the culprit is that `currentException = ex.getNextException();`
That should be `currentException = currentException.getNextException();`

It ends up in an infinite loop if `ex` actually has a next exception and
neither ex or that next exception are fatal. That code has been that way
at least since 2016, so I'm surprised no one has been bitten by that
earlier.

As a workaround, consider using org.firebirdsql.ds.FBSimpleDataSource
(Resource Type: javax.sql.DataSource) instead in that configuration.

I'll create a ticket and fix this.

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Mar 6, 2026, 7:12:18 AM (14 days ago) Mar 6
to firebi...@googlegroups.com
On 06-03-2026 13:01, 'Mark Rotteveel' via firebird-java wrote:
> As a workaround, consider using org.firebirdsql.ds.FBSimpleDataSource
> (Resource Type: javax.sql.DataSource) instead in that configuration.
>
> I'll create a ticket and fix this.

I created https://github.com/FirebirdSQL/jaybird/issues/927

Mark
--
Mark Rotteveel

Fabio Luis - Vanguarda TI

unread,
Mar 6, 2026, 8:22:54 AM (14 days ago) Mar 6
to firebi...@googlegroups.com
Hi Mark,

This behavior has been happening for a few years now, but since it's extremely sporadic, I'd never been able to reproduce it.

Yesterday I was profiling an application and by coincidence the problem occurred and I was able to capture it.

> As a workaround, consider using org.firebirdsql.ds.FBSimpleDataSource
> (Resource Type: javax.sql.DataSource) instead in that configuration.

I currently use a JDBC connection pool on the Payara application server.

I'm not familiar with the difference between FBSimpleDataSource and FBConnectionPoolDataSource in a connection pool. Could you please point out what I would be gaining (or losing) with this change? And does FBSimpleDataSource work with JDBC connection pools?


> I'll create a ticket and fix this.

Could you share the link so I can follow along, please?

Kind Regards
Fabio Silva


--
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:
https://www.firebirdsql.org/donate
---
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.
To view this discussion visit https://groups.google.com/d/msgid/firebird-java/0760a7ee-db5f-4e00-a953-a5007c67d17a%40lawinegevaar.nl.

Mark Rotteveel

unread,
Mar 6, 2026, 1:12:20 PM (13 days ago) Mar 6
to firebi...@googlegroups.com
On 06-03-2026 14:22, Fabio Luis - Vanguarda TI wrote:
> > As a workaround, consider using org.firebirdsql.ds.FBSimpleDataSource
> > (Resource Type: javax.sql.DataSource) instead in that configuration.
>
> I currently use a JDBC connection pool on the Payara application server.
>
> I'm not familiar with the difference between FBSimpleDataSource and
> FBConnectionPoolDataSource in a connection pool. Could you please point
> out what I would be gaining (or losing) with this change? And does
> FBSimpleDataSource work with JDBC connection pools?


It will work. Instead of Jaybird providing the PooledConnection
implementation, Payara itself will provide the equivalent of that to
wrap the physical connection returned by the data source. In fact,
Payara's documentation doesn't even mention
javax.sql.ConnectionPoolDataSource, so it might even be better to switch
to using FBSimpleDataSource anyway. Don't switch to FBXADataSource (a
javax.sql.XADataSource), as that has the same flaw, and if you don't use
distributed transactions, you don't need it.

It shouldn't make much difference, except that you'll rely on what
Payara considers fatal exceptions to invalidate connections, instead of
Jaybird. That could result in connections sometimes being invalidated
when they could be reused. However, given Jaybird itself will usually
close the physical connection on fatal errors anyway, that shouldn't
matter much in practice.

That said, I haven't used Payara myself, so you will want to verify that
for yourself.

> > I'll create a ticket and fix this.
>
> Could you share the link so I can follow along, please?

I posted that in a later message:

Fabio Luis - Vanguarda TI

unread,
Mar 6, 2026, 1:29:13 PM (13 days ago) Mar 6
to firebi...@googlegroups.com
Thanks a lot ;-)

Fabio Silva


--
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:
https://www.firebirdsql.org/donate
---
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,
Mar 7, 2026, 7:13:08 AM (13 days ago) Mar 7
to firebi...@googlegroups.com
Fix has been committed. I expect to release Jaybird 5.0.12 and Jaybird
6.0.5 by the end of this month. Currently, some changes for JDBC 4.5
support are pending, and as Java 26 will be released later this month,
I'd prefer if those changes landed in these versions as well.

Mark
--
Mark Rotteveel

Fabio Luis - Vanguarda TI

unread,
Mar 7, 2026, 8:21:24 AM (13 days ago) Mar 7
to firebi...@googlegroups.com
Awesome!

Thanks
Fabio Silva


--
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:
https://www.firebirdsql.org/donate
---
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