上下文
我有一个Web服务在队列中编写测试id。然后,侦听器读取队列,搜索测试并启动它。在这些步骤中,它在数据库中写入测试的更新以便显示给用户。更准确地说:测试是在docker容器中启动的,在测试结束时,我想将测试的状态更新为 FINISHED
. 为此,我使用带有回调的DockerJava库。
问题
当调用回调时,我会在调用中收到多条错误消息来更新测试(但是它只发生一次,如果我第二次尝试两次,它仍然会从事务管理器中写入大量错误消息)。
以下是记录的错误消息:
2020-11-20 09:20:43,639 WARN [docker-java-stream--1032099154] (org.jboss.jca.core.connectionmanager.listener.TxConnectionListener) IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@600268e6[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@236f1a69 connection handles=1 lastReturned=1605860423264 lastValidated=1605860242146 lastCheckedOut=1605860443564 trackByTx=true pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@2efb0d3b mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@3e8e7a62[pool=ApplicationDS] xaResource=LocalXAResourceImpl@482fdad2[connectionListener=600268e6 connectionManager=4c83f895 warned=false currentXid=null productName=Oracle productVersion=Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0 jndiName=java:/ApplicationDS] txSync=TransactionSynchronization@1387480544{tx=Local transaction (delegate=TransactionImple < ac, BasicAction: 0:ffffac110002:-50a6b0bf:5fb6bdb9:73db4 status: ActionStatus.ABORTING >, owner=Local transaction context for provider JBoss JTA transaction provider) wasTrackByTx=true enlisted=true cancel=false}]: java.sql.SQLRecoverableException: IO Error: Socket read interrupted
2020-11-20 09:20:43,647 INFO [docker-java-stream--1032099154] (org.jboss.jca.core.connectionmanager.listener.TxConnectionListener) IJ000302: Unregistered handle that was not registered: org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8@4f3c1cb2 for managed connection: org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@236f1a69
2020-11-20 09:20:43,656 WARN [docker-java-stream--1032099154] (com.arjuna.ats.jta) ARJUNA016031: XAOnePhaseResource.rollback for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac110002:-50a6b0bf:5fb6bdb9:73db4, node_name=1, branch_uid=0:ffffac110002:-50a6b0bf:5fb6bdb9:73db8, subordinatenodename=null, eis_name=java:/ApplicationDS > failed with exception: org.jboss.jca.core.spi.transaction.local.LocalXAException: IJ001160: Could not rollback local transaction
Caused by: org.jboss.jca.core.spi.transaction.local.LocalResourceException: IO Error: Socket read interrupted
at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:139)
...
Caused by: java.sql.SQLRecoverableException: IO Error: Socket read interrupted
at com.oracle.jdbc//oracle.jdbc.driver.T4CConnection.doRollback(T4CConnection.java:1140)
...
Caused by: java.io.InterruptedIOException: Socket read interrupted
at com.oracle.jdbc//oracle.net.nt.TimeoutSocketChannel.handleInterrupt(TimeoutSocketChannel.java:258)
...
1条答案
按热度按时间x4shl7ld1#
解释
一开始,我考虑了一个连接问题,也许事务在回调时不再可用(因为docker运行花费了太长时间),也许它必须失效。
但是最后,正如控制台中所写的,它来自线程的中断,当它试图获取锁来更新测试时,我发现了这个中断的来源:我查看了这个方法
executeAndStream
在DefaultInvocationBuilder
从docker java库中,我发现:这是给你的
onStart
中断线程。之后,我发现onComplete
从ResultCallbackTemplate
(我在延长回拨时间)关闭关闭:分辨率
问题最终来自我编写的以下代码:
我在给警察打电话
onComplete
方法,而不知道is通常做什么,在做任何其他事情之前。为了纠正这个问题,我只需要在最后调用super方法: