gpt4 book ai didi

MySQLNonTransientConnectionException : Communications link failure during commit(). 事务解析未知

转载 作者:行者123 更新时间:2023-11-29 02:20:42 27 4
gpt4 key购买 nike

每当我在 Hudson 中构建作业时,在尝试将结果存储到数据库中时总是会在最后失败。整个工作通常需要大约一个小时的时间来构建和失败。

源文件存储在SVN服务器上,可在本地下载和编辑。一旦我验证作业能够在本地成功构建,我就将所有更改提交到 SVN。

我最近改用了一种基于 ANT 的方法,该方法使 ant 目标与 session 审阅者相匹配。所以我创建了一个sonar.xml文件,其中包含一个名为sonar_scan的目标,在项目的build.xml文件中调用。

我已将 net_read_timeout、net_write_timeout 和 innodb_lock_wait_timeout 设置为 10 分钟,而不是它们的默认值 60 秒或更短。 wait_timeout 设置为 8 小时,所以我知道 wait_timeout 不是问题。

  • 我使用的数据库是mysql version 5.6.25
  • 我使用的 Sonar 版本是 5.1

我收到的完整错误信息是:

[sonar:sonar] 19:09:43.831 ERROR - JDBC commit failed    
[sonar:sonar] com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.
[sonar:sonar] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_45]
[sonar:sonar] at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_45]
[sonar:sonar] at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.Util.getInstance(Util.java:360) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1611) ~[mysql-connector-java-5.1.34.jar:5.1.34]
[sonar:sonar] at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334) ~[sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211) ~[sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:170) ~[sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:146) ~[sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.jpa.session.JpaDatabaseSession.commit(JpaDatabaseSession.java:83) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.jpa.session.JpaDatabaseSession.commitAndClose(JpaDatabaseSession.java:69) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.jpa.session.JpaDatabaseSession.stop(JpaDatabaseSession.java:64) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
[sonar:sonar] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
[sonar:sonar] at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.stop(ReflectionLifecycleStrategy.java:96) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.stop(AbstractInjectionFactory.java:88) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.behaviors.AbstractBehavior.stop(AbstractBehavior.java:179) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.behaviors.Stored$RealComponentLifecycle.stop(Stored.java:141) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.behaviors.Stored.stop(Stored.java:118) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1047) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:802) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:123) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:118) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.batch.bootstrapper.Batch.stop(Batch.java:107) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) [sonar-batch-maven-compat-5.1.jar:na]
[sonar:sonar] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) [sonar-runner-batch1253226961910621726.jar:na]
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
[sonar:sonar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
[sonar:sonar] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
[sonar:sonar] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_45]
[sonar:sonar] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.runner.api.Runner.execute(Runner.java:100) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:51) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.sonar.ant.SonarTask.execute(SonarTask.java:46) [sonar-ant-task-2.3.jar:na]
[sonar:sonar] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) [ant.jar:1.9.2]
[sonar:sonar] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) ~[na:na]
[sonar:sonar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
[sonar:sonar] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
[sonar:sonar] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [ant.jar:na]
[sonar:sonar] at org.apache.tools.ant.Task.perform(Task.java:348) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Target.execute(Target.java:435) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Target.performTasks(Target.java:456) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Project.executeTarget(Project.java:1364) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [ant.jar:na]
[sonar:sonar] at org.apache.tools.ant.Project.executeTargets(Project.java:1248) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Main.runBuild(Main.java:851) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.Main.startAnt(Main.java:235) [ant.jar:1.9.2]
[sonar:sonar] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) [ant-launcher.jar:na]
[sonar:sonar] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) [ant-launcher.jar:na]
[sonar:sonar] 19:09:43.831 WARN - SQL Error: 0, SQLState: null
[sonar:sonar] 19:09:43.831 ERROR - Already closed.

BUILD FAILED
D:\SVN_7_1\buildscripts\sonar.xml:168: org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:51)
at org.sonar.ant.SonarTask.execute(SonarTask.java:46)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.hibernate.exception.GenericJDBCException: Cannot release connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:429)
at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:316)
at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:248)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:158)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
at org.sonar.jpa.session.JpaDatabaseSession.commit(JpaDatabaseSession.java:83)
at org.sonar.jpa.session.JpaDatabaseSession.commitAndClose(JpaDatabaseSession.java:69)
at org.sonar.jpa.session.JpaDatabaseSession.stop(JpaDatabaseSession.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.stop(ReflectionLifecycleStrategy.java:96)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.stop(AbstractInjectionFactory.java:88)
at org.picocontainer.behaviors.AbstractBehavior.stop(AbstractBehavior.java:179)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.stop(Stored.java:141)
at org.picocontainer.behaviors.Stored.stop(Stored.java:118)
at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1047)
at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:802)
at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:123)
at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:118)
at org.sonar.batch.bootstrapper.Batch.stop(Batch.java:107)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 24 more
Caused by: java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)
at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:97)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:474)
... 54 more

Total time: 42 minutes 5 seconds

我到处寻找可能的解决方案,但到目前为止我还没有找到。如果有人可以建议我还没有做过的事情,那么我将不胜感激。

最佳答案

网络不稳定

重现代码:

con.query()
sleep(10) //when sleep shutdown your network
conn.roolback()

关于MySQLNonTransientConnectionException : Communications link failure during commit(). 事务解析未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32349610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com