[ 
https://issues.apache.org/jira/browse/DERBY-6175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922047#comment-13922047
 ] 

Marco commented on DERBY-6175:
------------------------------

Hi Knut,

thanks a lot for your reply! And sorry for my late response - I was *extremely* 
busy during the last weeks.

Well, the "No current connection" exception should not be a direct consequence 
of the connection getting closed by the first exception, because I'm closing 
Derby explicitly and re-opening the connection. My code tries this multiple 
times, but it seems to me that it always fails, if it failed once (though I'm 
not 100% sure).

Thus, it can only be a consequence of the first exception, if the database is 
permanently corrupted by the first error or if there is data still lingering in 
memory that is not cleaned up despite my closing the connection and explicitly 
garbage-collecting.

It is unfortunately not possible to "reliably reproduce this bug" - this bug is 
clearly a Heisenbug. You can see this when browsing this build history:

https://codewizards.co/jenkins/job/co.codewizards.cloudstore/

Look for the yellow icons (indicating a test failure). Nearly all test failures 
are caused by this derby bug. If the error message is >>Schema Transaction 
threw exception "Add classes to Catalog "", Schema "ROOT""<<, then you'll find 
the "No current connection" to be the cause. I permanently conserved build 200 
showing this error:

https://codewizards.co/jenkins/job/co.codewizards.cloudstore/200/

But as said, this is not the only occurrence of the error - see builds 223, 
225, 232, 233 and many more.

As you can also see there, the test failing is always a different one. And 
despite the bug, many builds succeed. The code failing is always the same:

java.sql.SQLNonTransientConnectionException: No current connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.getAutoCommit(Unknown 
Source)
        at 
org.datanucleus.store.rdbms.datasource.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:338)
        at 
org.datanucleus.store.rdbms.datasource.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getAutoCommit(PoolingDataSource.java:237)
        at 
org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:131)
        at 
org.datanucleus.store.rdbms.RDBMSStoreManager.addClasses(RDBMSStoreManager.java:1605)
        at 
org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:954)
        at 
org.datanucleus.store.AbstractStoreManager.getExtent(AbstractStoreManager.java:1061)
        at 
org.datanucleus.ExecutionContextImpl.getExtent(ExecutionContextImpl.java:5558)
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.getExtent(JDOPersistenceManager.java:1560)
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.getExtent(JDOPersistenceManager.java:1581)
        at 
co.codewizards.cloudstore.core.repo.local.LocalRepoManagerImpl.initPersistenceCapableClasses(LocalRepoManagerImpl.java:362)
        at 
co.codewizards.cloudstore.core.repo.local.LocalRepoManagerImpl.initPersistenceManagerFactoryAndPersistenceCapableClassesWithRetry(LocalRepoManagerImpl.java:330)
        at 
co.codewizards.cloudstore.core.repo.local.LocalRepoManagerImpl.initPersistenceManagerFactory(LocalRepoManagerImpl.java:275)
        at 
co.codewizards.cloudstore.core.repo.local.LocalRepoManagerImpl.<init>(LocalRepoManagerImpl.java:134)
        at 
co.codewizards.cloudstore.core.repo.local.LocalRepoManagerFactory.createLocalRepoManagerForNewRepository(LocalRepoManagerFactory.java:144)
        at 
co.codewizards.cloudstore.core.repo.sync.RepoToRepoSyncTest.syncFromRemoteToLocal(RepoToRepoSyncTest.java:80)
        at 
co.codewizards.cloudstore.core.repo.sync.RepoToRepoSyncTest.syncMovedFile(RepoToRepoSyncTest.java:497)
        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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
        at 
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
        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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        at 
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
        at 
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: java.sql.SQLException: No current connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
 Source)
        ... 52 more

I did not count how often exactly this code succeeds and how often it fails, 
but I can give you a rough estimation: CloudStore has currently about 50 tests. 
Roughly 45 of these tests run through this code location twice, thus said code 
location is invoked ca. 90 times (in total) per build. Most builds having the 
problem encounter it only once (very few 2 or 3 times). As you can see in the 
build history, between 5% and 10% of the builds fail (with the "No current 
connection" exception). That makes a probability of the bug of roughly 0.5% to 
1%.

How often the bug occurs seems to depend primarily on the hardware being used. 
On my development machine, being much faster and having more RAM than the build 
server, the error occurs far more often. I did not count, but I've the 
impression that here about 1 in 3 builds fails, resulting in a bug probability 
of roughly 3%.

Given the low probability of the bug, it seems impossible to provide "a test 
case that *reliably* reproduces this bug". However, the test suite of 
CloudStore produces this bug with a pretty high probability and is easy to 
obtain + run (git clone + maven clean install).

See: http://cloudstore.codewizards.co/0.9.1/documentation/development.html

I hope that this is helpful. Maybe you find some more information in the 
(public) build logs on our jenkins: 
https://codewizards.co/jenkins/job/co.codewizards.cloudstore/

Please let me know, if there's sth. more I can do to assist you in tracking 
down this bug.

Best regards, Marco :-)

> testComparisonAcrossPages failure - 
> java.sql.SQLNonTransientConnectionException: No current connection.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6175
>                 URL: https://issues.apache.org/jira/browse/DERBY-6175
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.10.1.4
>            Reporter: Mamta A. Satoor
>
> Failure on 10.10.1.2(1466316) windows machine with IBM 1.7
> http://people.apache.org/~myrnavl/derby_test_results/v10_10/windows/testlog/ibm17/1466316-suites.All_diff.txt
> 1) 
> testComparisonAcrossPages(org.apache.derbyTesting.functionTests.tests.lang.NullableUniqueConstraintTest)java.sql.SQLNonTransientConnectionException:
>  No current connection.
>       at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>       at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
>       at org.apache.derby.client.am.PreparedStatement.setString(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.NullableUniqueConstraintTest.testComparisonAcrossPages(NullableUniqueConstraintTest.java:393)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:442)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:459)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: org.apache.derby.client.am.SqlException: No current connection.
>       at org.apache.derby.client.am.Statement.checkForClosedStatement(Unknown 
> Source)
>       at 
> org.apache.derby.client.am.PreparedStatement.getColumnMetaDataX(Unknown 
> Source)
>       ... 46 more



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to