Process engine persistence exception - Embedded process engine

Hi, we experienced this exception:

java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.DataOutputStream.write(DataOutputStream.java:107)
at net.sourceforge.jtds.jdbc.SharedSocket.sendNetPacket(SharedSocket.java:686)
at net.sourceforge.jtds.jdbc.RequestStream.putPacket(RequestStream.java:570)
at net.sourceforge.jtds.jdbc.RequestStream.flush(RequestStream.java:518)
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1080)
… 98 common frames omitted
Wrapped by: java.sql.SQLException: I/O Error: Connection reset
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1093)
at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:938)
at net.sourceforge.jtds.jdbc.JtdsConnection.setAutoCommit(JtdsConnection.java:2312)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.datasource.pooled.PooledConnection.invoke(PooledConnection.java:245)
at com.sun.proxy.$Proxy22.setAutoCommit(Unknown Source)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:102)
… 90 common frames omitted
Wrapped by: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:107)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:142)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:60)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336)
at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:90)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
… 81 common frames omitted
Wrapped by: org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset

The error may exist in org/camunda/bpm/engine/impl/mapping/entity/EventSubscription.xml

The error may involve org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity.selectEventSubscriptionByQueryCriteria

The error occurred while executing a query

Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

Having read the other threads related to this issue its due to the server closing the connection. The suggestions in those other threads it to configure testOnBorrow and validationQuery. What is the corresponding configuration for the embedded java engine. This is out setup currently:

private val workflowConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()
.setJdbcDriver(“net.sourceforge.jtds.jdbc.Driver”)
.setJdbcUrl(url)
.setJdbcUsername(username)
.setJdbcPassword(password)
.setJdbcMaxActiveConnections(20)
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setHistory(ProcessEngineConfiguration.HISTORY_FULL)
.setJobExecutorActivate(true)

@Andrew_Henderson do you running the camunda as spring boot application with spring security?

I resolved this by using setJdbcPingEnabled, setJdbcPingQuery and setJdbcPingConnectionNotUsedFor when setting up the process engine.

This SocketException:Connection reset simply means that a TCP RST was received. TCP RST packet is that the remote side telling you the connection on which the previous TCP packet is sent is not recognized, maybe the connection has closed, maybe the port is not open, and something like these. A reset packet is simply one with no payload and with the RST bit set in the TCP header flags.

The following are possible causes for the error:

  • More commonly, it is caused by writing to a connection that the other end has already closed normally. In other words an application protocol error.

  • A Reset (RST) packet is received from a remote machine and interrupts the established connection. The sent RST packets may indicate that the TCP packets sent are not recognized, a connection between the local and remote machine is broken, or a particular port is closed and is not allowing for communication.

  • The TCP (Transmission Control Protocol) socket is closed because the socket received a close command from a remote machine.

  • The other end has deliberately reset the connection. It is rarely happens, and generally incorrect, for application software to do this, but it is not unknown for commercial software.

  • It can also be caused by closing a socket when there is unread data in the socket receive buffer.