Running out of connections using JDBC Event/Saga Store

Hi folks,

In a small toy project, we are not relying on SpringBoot, but on Ktor for running Axon application. In doing so, we configure AxonFramework in a SE-way (using configurer).

For the development time, we used InMemory Store implementations for both Event and Saga stores and everything worked fine.

For going to production, we decided to just use the minimal setup and tried to get stuff running using JdbcStore.
For doing so, we tried out and failed with the following setups:

  • Hikari CP with MySQL 7.x
  • Driver MySQL 7.x
  • Hikari CP with MariaDB latest
  • Driver MariaDB latest

The errors (more or less the same) were: too many connections.
If using Hikari, it complaints about missing commit in transaction (leaving a dirty transaction). The native DB drivers are not complaining, but just fail after some (very short) time.

Any ideas?
In a meantime, we switched to AxonServer and everything works as desired.

P.S. The implementation is straight forward:

-> ConnectionProvider retrieves the connection directly from a DataSource
-> TransactionManager is creating a new Transaction using connection as a backing field, switches autocommit off and runs commit / rollback directly on connection.

Cheers,

Simon

Hi Simon,

did you (just) use the DataSourceConnectionProvider? If so, there may be an issue in linking the transaction manager’s Connection and the one used by the EventStorageEngine. The UnitOfWorkAwareConnectionProviderWrapper was built to fix that issue, basically ensuring that a single connection is used for the duration of the Unit of Work. Requests to close the connection are ignored, as the connection is closed when the unit of work completes.

Cheers,