Wildfly detection database connection leaks

586 views Asked by At

I have application, deployed in wildfly. And sometimes in application occurs db connection leaks. I really cannot find them in debugger. But they are shown in WildFly Management Console in datasource statistics page, InUseCount sometimes incremented.

So, questions:

  1. It is possible to create handler that firing when connection created and closed? To find globally who does not close connection.
  2. Is there connections leaks troubleshooting approach, more effective than simple debugging?
1

There are 1 answers

0
Alex T On

I found this article:

http://www.mastertheboss.com/jbossas/wildfly9/detecting-connection-leaks-in-wildfly-9

But it is not accurate for modern versions of WildFly (for example 19 and higher). Problem in that in modern versions WildFly when starts not use parameter ironjacamar.mcp. Instead of this parameter mcp option of datasource must be used.

Docs about datasource options:

https://docs.wildfly.org/19.1/wildscribe/subsystem/datasources/xa-data-source/index.html

After adding mcp option when flushing datasources, file leaks.txt appears.