[
https://issues.apache.org/jira/browse/JCR-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630649#action_12630649
]
Brennan Spies commented on JCR-1572:
------------------------------------
I haven't looked at the patch yet, but I am experiencing a very similar problem
using Apache Derby. It is occurring because I am using Artifactory 1.3 (beta)
which updates its Maven indexes using Quartz scheduled jobs that rely on Apache
Jackrabbit to store/persist the data. The code path of the problem is the
same--through the addRecord() method, which automatically calls
setAutoReconnect(false) without checking for a valid connection. Forgive me if
I am repeating the above discussion, but there are two problems here:
1. Not checking for valid connection before setting autoReconnect(false). This
seems to be happening constantly in the Artifactory jobs, since they are
long-running and the connections tend to time out. Some logic equivalent to
DBCP's testOnBorrow() needs to be implemented.
2. The setAutoReconnect(false)...setAutoReconnect(true) are both inside a
try-catch block. What happens here if an exception is thrown between the two
calls? Since the ConnectionRecoveryManager instances are held in a pool (the
Pool class), the ConnectionRecoveryManager will be returned to the pool with
the autoReconnect flag = false. Assuming that execution continues after the
original exception, this ConnectionRecoveryManager instance will be likely to
throw another exception if a connection timeout occurs. THE SOLUTION: restore
the correct flag using setAutoReconnect in the finally block.
These should be very easy fixes to implement.
The exception looks like this:
[9/12/08 11:05:24:697 PDT] 0000004e SystemOut O 2008-09-12 11:05:24,696
[WARN ] (data.db.DbDataStore :588) - Can not insert new record
org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record:
connection has been closed and autoReconnect == false: connection has been
closed and autoReconnect == false
at
org.apache.jackrabbit.core.data.db.DbDataStore.convert(DbDataStore.java:592)
at
org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:295)
at
org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:120)
at
org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:644)
at
org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:123)
at
org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:609)
at
org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:525)
at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2309)
at org.artifactory.jcr.fs.JcrFile.fillJcrData(JcrFile.java:591)
at org.artifactory.jcr.fs.JcrFile.setResourceNode(JcrFile.java:550)
at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:80)
at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:164)
at
org.artifactory.repo.index.RepoIndexerData.saveIndexFiles(RepoIndexerData.java:103)
at
org.artifactory.repo.index.IndexerManagerImpl.saveIndexFiles(IndexerManagerImpl.java:168)
at
org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at
org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.saveIndexFiles(<generated>)
at
org.artifactory.repo.index.IndexerManagerImpl.index(IndexerManagerImpl.java:137)
at
org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at
org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.index(<generated>)
at org.artifactory.repo.index.IndexerJob.onExecute(IndexerJob.java:25)
at
org.artifactory.schedule.ArtifactoryJob.execute(ArtifactoryJob.java:41)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: java.sql.SQLException: connection has been closed and autoReconnect
== false
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.getConnection(ConnectionRecoveryManager.java:159)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:287)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237)
at
org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:286)
... 33 more
> DbDataStore connection does not always reconnect
> ------------------------------------------------
>
> Key: JCR-1572
> URL: https://issues.apache.org/jira/browse/JCR-1572
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
> Reporter: Moshe Immerman
> Assignee: Thomas Mueller
> Attachments: jackrabbit-trunk.patch, jackrabbit1.4.patch
>
>
> If a DbDataStore connection is closed due to an error all subsequent
> addRecord calls will fail with 'connection has been closed and autoReconnect
> == false'
> after getRecord is called and the connection is reconnected addRecord will
> succeed.
> the connection should be validated before setting autoReconnect = false or on
> retrieval from the pool.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.