[
http://jira.jboss.com/jira/browse/JBAS-732?page=comments#action_12345657 ]
Jan Normann Nielsen commented on JBAS-732:
------------------------------------------
Yes, synchronizing three methods in this class is not only overkill but results in JBoss
not being able to detect deadlocks involving the AutoNumber entity bean. Instead they just
result in transaction timeouts. In my environment, no new AutoNumber sequences need to be
created, therefore I'm not in a situation that DuplicateKeyException is thrown.
Therefore, I always use the autonumber-plugin.jar from an early JBoss version where the
methods weren't synchronized. Otherwise, using AutoNumberFactory is unusable because
of the deadlock scenario described above.
I think something should be done so that both problems (DuplicateKeyException and no in-VM
locking) are resolved. Is it not possible?
AutoNumberFactory not thread safe
---------------------------------
Key: JBAS-732
URL:
http://jira.jboss.com/jira/browse/JBAS-732
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: JBossAS-3.2.6 Final
Reporter: SourceForge User
Assigned To: Scott M Stark
Fix For: Closed issues from sourceforge
SourceForge Submitter: esriram .
The getNextInteger() method in the
org.jboss.varia.autonumber.AutoNumberFactory is not
thread safe.
If multiple threads call this method the
EJBHome.create() is getting called more than once which
leads to a DuplicateKeyException. Stack trace given below.
The fix will be to do a create in a synchronized block.
--E.Sriram
18:38:32:145] [09-08-2003] [syserr] [INFO] [14] :
javax.ejb.DuplicateKeyException: Entity with primary
key Address.ADDRESSID already exists [18:38:32:145]
[09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:205)
[18:38:32:146] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:569)
[18:38:32:147] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:225)
[18:38:32:147] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
[18:38:32:148] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
[18:38:32:148] [09-08-2003] [syserr] [INFO] [14] : at
sun.reflect.GeneratedMethodAccessor77.invoke(Unknown
Source) [18:38:32:148] [09-08-2003] [syserr] [INFO]
[14] : at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[18:38:32:148] [09-08-2003] [syserr] [INFO] [14] : at
java.lang.reflect.Method.invoke(Method.java:324)
[18:38:32:149] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998)
[18:38:32:149] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
[18:38:32:149] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188)
[18:38:32:149] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
[18:38:32:150] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
[18:38:32:150] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:91)
[18:38:32:150] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
[18:38:32:150] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
[18:38:32:151] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
[18:38:32:151] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
[18:38:32:151] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)
[18:38:32:151] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.authentication.interceptor.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
[18:38:32:152] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
[18:38:32:152] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
[18:38:32:152] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
[18:38:32:267] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:477)
[18:38:32:268] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.Container.invoke(Container.java:694)
[18:38:32:268] [09-08-2003] [syserr] [INFO] [14] : at
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown
Source) [18:38:32:269] [09-08-2003] [syserr] [INFO]
[14] : at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[18:38:32:269] [09-08-2003] [syserr] [INFO] [14] : at
java.lang.reflect.Method.invoke(Method.java:324)
[18:38:32:269] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
[18:38:32:269] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
[18:38:32:270] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
[18:38:32:270] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83)
[18:38:32:270] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
[18:38:32:270] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.authentication.interceptor.ClientPrincipalAssociator.invoke(ClientPrincipalAssociator.java:44)
[18:38:32:271] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
[18:38:32:271] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
[18:38:32:271] [09-08-2003] [syserr] [INFO] [14] : at
$Proxy36.create(Unknown Source) [18:38:32:271]
[09-08-2003] [syserr] [INFO] [14] : at
org.jboss.varia.autonumber.AutoNumberFactory.getNextInteger(AutoNumberFactory.java:60)
[18:38:32:272] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.db.persistence.LongSequenceGenerator.nextValue(LongSequenceGenerator.java:29)
[18:38:32:272] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.persistence.DataAccess.generateValues(DataAccess.java:2049)
[18:38:32:272] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.persistence.DataAccess.insertRows(DataAccess.java:2136)
[18:38:32:272] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.persistence.DataAccess.add(DataAccess.java:196)
[18:38:32:273] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.nms.topo.ejb.internal.TopoBean.addResource(TopoBean.java:182)
[18:38:32:273] [09-08-2003] [syserr] [INFO] [14] : at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) [18:38:32:273] [09-08-2003] [syserr] [INFO]
[14] : at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[18:38:32:273] [09-08-2003] [syserr] [INFO] [14] : at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[18:38:32:274] [09-08-2003] [syserr] [INFO] [14] : at
java.lang.reflect.Method.invoke(Method.java:324)
[18:38:32:274] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
[18:38:32:376] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
[18:38:32:377] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractInterceptor.invoke(AbstractInterceptor.java:94)
[18:38:32:377] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
[18:38:32:377] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
[18:38:32:378] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
[18:38:32:378] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
[18:38:32:378] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.authentication.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
[18:38:32:379] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
[18:38:32:379] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.logging.tracing.TracingInterceptor.invoke(TracingInterceptor.java:45)
[18:38:32:379] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
[18:38:32:379] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
[18:38:32:380] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.ejb.Container.invoke(Container.java:674)
[18:38:32:380] [09-08-2003] [syserr] [INFO] [14] : at
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown
Source) [18:38:32:380] [09-08-2003] [syserr] [INFO]
[14] : at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[18:38:32:380] [09-08-2003] [syserr] [INFO] [14] : at
java.lang.reflect.Method.invoke(Method.java:324)
[18:38:32:381] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
[18:38:32:381] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
[18:38:32:381] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
[18:38:32:381] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83)
[18:38:32:382] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
[18:38:32:382] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.authentication.interceptor.ClientPrincipalAssociator.invoke(ClientPrincipalAssociator.java:44)
[18:38:32:382] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
[18:38:32:382] [09-08-2003] [syserr] [INFO] [14] : at
org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
[18:38:32:383] [09-08-2003] [syserr] [INFO] [14] : at
$Proxy78.addResource(Unknown Source) [18:38:32:526]
[09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.nms.topo.discovery.wf.network.task.NetworkDiscoveryStartTask.modelNetwork(NetworkDiscoveryStartTask.java:338)
[18:38:32:526] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.nms.topo.discovery.wf.network.task.NetworkDiscoveryStartTask.executeTask(NetworkDiscoveryStartTask.java:89)
[18:38:32:527] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.task.internal.TaskManagerImpl.executeTask(TaskManagerImpl.java:343)
[18:38:32:527] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.task.internal.TaskManagerImpl.executeTask(TaskManagerImpl.java:85)
[18:38:32:527] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.executor.internal.WorkFlowExecutor.executeTask(WorkFlowExecutor.java:333)
[18:38:32:527] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.executor.internal.WorkFlowExecutor.controlWorkFlow(WorkFlowExecutor.java:182)
[18:38:32:528] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.executor.internal.WorkFlowExecutor.executeWorkFlowTemplate(WorkFlowExecutor.java:119)
[18:38:32:528] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.executor.internal.WorkFlowExecutor.executeWorkFlow(WorkFlowExecutor.java:93)
[18:38:32:528] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.internal.WorkEngineImpl$WorkFlowExecutorThread.run(WorkEngineImpl.java:675)
[18:38:32:528] [09-08-2003] [syserr] [INFO] [14] : at
com.adventnet.workengine.threadpool.ThreadPool$WorkerThread.run(ThreadPool.java:299)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira