Bug 996939 - Clearing a TM while an import is in progress can fail (almost) silently.
Summary: Clearing a TM while an import is in progress can fail (almost) silently.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: 3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Sean Flanigan
QA Contact: Zanata-QA Mailling List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-14 10:22 UTC by Damian Jansen
Modified: 2013-11-27 03:31 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-27 03:31:47 UTC
Embargoed:


Attachments (Terms of Use)

Description Damian Jansen 2013-08-14 10:22:19 UTC
Description of problem:
An admin that starts a Clear operation on a TM during another's large TM import may have the operation appear to complete, but nothing is cleared.

Version-Release number of selected component (if applicable):
3.0

How reproducible:
Moderate sometimes

Steps to Reproduce:
Pre: A large TMX is available, two admin users are signed in (or just use the same admin with two tabs)
1. As one admin,
- go to Administration, Translation Memory
- start a large import to a TM
2. As another admin,
- go to Administration, Translation Memory
- start the clear of the same TM

Actual results:
Occasionally fails with an exception

Expected results:
Either complete, or lock the operation while import is in progress

Additional info:
20:11:06,632 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (DefaultQuartzScheduler_Worker-2) SQL Error: 0, SQLState: null
20:11:06,637 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (DefaultQuartzScheduler_Worker-2) javax.resource.ResourceException: IJ000460: Error checking for a transaction
20:11:06,637 ERROR [org.zanata.process.AsynchronousExecutor] (DefaultQuartzScheduler_Worker-2) Exception with long running process: Could not open connection: org.hibernate.exception.GenericJDBCException: Could not open connection
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:98) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:85) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.persister.entity.AbstractEntityPersister.loadEntityIdByNaturalId(AbstractEntityPersister.java:4782) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.event.internal.DefaultResolveNaturalIdEventListener.loadFromDatasource(DefaultResolveNaturalIdEventListener.java:128) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.event.internal.DefaultResolveNaturalIdEventListener.resolveNaturalId(DefaultResolveNaturalIdEventListener.java:95) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.event.internal.DefaultResolveNaturalIdEventListener.onResolveNaturalId(DefaultResolveNaturalIdEventListener.java:61) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.internal.SessionImpl.fireResolveNaturalId(SessionImpl.java:1100) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.internal.SessionImpl.access$2100(SessionImpl.java:174) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.internal.SessionImpl$BaseNaturalIdLoadAccessImpl.resolveNaturalId(SessionImpl.java:2528) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.internal.SessionImpl$NaturalIdLoadAccessImpl.load(SessionImpl.java:2640) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.zanata.dao.TransMemoryDAO.getBySlug(TransMemoryDAO.java:69) [classes:]
	at org.zanata.dao.TransMemoryDAO.deleteTransMemoryContents(TransMemoryDAO.java:84) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_37]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_37]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_37]
	at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_37]
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:186) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:104) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.zanata.dao.TransMemoryDAO_$$_javassist_seam_48.deleteTransMemoryContents(TransMemoryDAO_$$_javassist_seam_48.java) [classes:]
	at org.zanata.action.TranslationMemoryAction$1.run(TranslationMemoryAction.java:101) [classes:]
	at org.zanata.process.AsynchronousExecutor.runAsynchronously(AsynchronousExecutor.java:61) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_37]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_37]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_37]
	at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_37]
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:186) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:104) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.zanata.process.AsynchronousExecutor_$$_javassist_seam_108.runAsynchronously(AsynchronousExecutor_$$_javassist_seam_108.java) [classes:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_37]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_37]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_37]
	at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_37]
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) [jboss-seam-2.3.0.Final.jar:2.3.0.Final]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:203) [quartz-1.5.2.jar:1.5.2]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) [quartz-1.5.2.jar:1.5.2]
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
	at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)
	at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.zanata.database.WrappedDatasourceConnectionProvider.getConnection(WrappedDatasourceConnectionProvider.java:45) [classes:]
	at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final]
	... 63 more
Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
	at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:362)
	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
	at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source) [:1.6.0_37]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_37]
	at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_37]
	at net.bull.javamelody.JdbcWrapper$ConnectionManagerInvocationHandler.invoke(JdbcWrapper.java:230) [javamelody-core-1.41.0.jar:1.41.0]
	at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:259) [javamelody-core-1.41.0.jar:1.41.0]
	at $Proxy25.allocateConnection(Unknown Source)	at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
	... 67 more
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff7f000001:-a261080:5209c1d7:101c status: ActionStatus.ABORTED >
	at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:352)
	... 75 more

Comment 1 Carlos Munoz 2013-08-15 06:21:48 UTC
I suggest we simply disable all activity (Delete, Clear or Upload) on a TM when there is an import or clearing going on.

Comment 2 Sean Flanigan 2013-08-15 07:17:32 UTC
I'll take this.

I'm introducing a pessimistic lock (as we have for copytrans), returning the owner's username if the lock is already taken, and returning a 503 response[1] if a client tries to POST to or DELETE from a locked translation memory.  503 isn't an exact match for semantics, but I think it's pretty close if you interpret "server/service" as "resource".

[1] 503 Service Unavailable
The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. -Wikipedia

Comment 3 Sean Flanigan 2013-08-16 06:40:17 UTC
https://github.com/zanata/zanata-server/pull/134

Comment 4 Damian Jansen 2013-08-28 04:32:32 UTC
Verified at 6cffb1ba3ce14c4c5803c1e40556bd8d58a60363

Comment 5 Sean Flanigan 2013-11-27 03:31:47 UTC
Closing VERIFIED bugs which predate Zanata 3.1.2.


Note You need to log in before you can comment on or make changes to this bug.