Bugs item #910911, was opened at 2004-03-06 14:33 Message generated for change (Comment added) made by loubyansky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=910911&group_id=22866
Category: JBossServer Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 5 Submitted By: Konstantin Sobolev (eprst) >Assigned to: Alexey Loubyansky (loubyansky) Summary: EntitySynchronizationInterceptor bug(?) Initial Comment: Hi all, I've encountered a problem with jboss 3.0.7, but according to CVS the same would be in latest release. I've got BMP entity bean, standard configuration. Two clients access the same bean instance without transaction context. I see the following in the log: client1: EntitySynchronizationInterceptor.invoke, ctx.isValid == false client1: ejbLoad started client1: ejbLoad finished, ctx.isValid == false client2: EntitySynchronizationInterceptor.invoke, ctx.isValid == false client2: ejbLoad started client1: ctx.isValid == true client1: business method Here my business method fails because ejbLoad in another thread (client2) is modifiyng bean's internal state. I thought that container should serialize calls to the same bean instance, but I'm not sure that this is the only possible spec. interpretation. As for me, I'd put ejbLoad call in EntitySynchronizationInterceptor.invoke into synchronized(ctx) block. ---------------------------------------------------------------------- >Comment By: Alexey Loubyansky (loubyansky) Date: 2004-03-07 05:27 Message: Logged In: YES user_id=543482 Yes, a deadlock is possible. As well as stack over flow if two instances load each other in ejbLoad. Deadlock can be fixed by moving synchronization to CMPPersistenceManager, just to ixclude ejbLoad invocation from the synchronized block. The same way stack overflow is fixed. Now, about why it is not thread-safe. I have no answer at the moment. This is why deadlock test fails. I have very interesting stacktraces. I couldn't find a bug just reading the code. So I am going to start with 3.2.3, port parts from 3.2.4 and run tests. ---------------------------------------------------------------------- Comment By: Adrian Brock (ejort) Date: 2004-03-07 02:15 Message: Logged In: YES user_id=9459 Alex, Can you explain how the deadlock is avoided? e.g. ejbLoad() on bean A leads to ejbLoad() on bean B and vice versa. Also, why isn't serialized access on the context lock in the re-entrance interceptor enough? How can two threads be in synchronization interceptor at the same time? I've re-open this bug report. Regards, Adrian ---------------------------------------------------------------------- Comment By: Konstantin Sobolev (eprst) Date: 2004-03-06 23:55 Message: Logged In: YES user_id=118051 thanks! ---------------------------------------------------------------------- Comment By: Alexey Loubyansky (loubyansky) Date: 2004-03-06 23:18 Message: Logged In: YES user_id=543482 On persistent context, not enterprise. ---------------------------------------------------------------------- Comment By: Alexey Loubyansky (loubyansky) Date: 2004-03-06 23:15 Message: Logged In: YES user_id=543482 Our testsuite, specifically deadlock test, tests entity beans with NotSupported. As I found today, this test in fact fails for 3.2.3 release on multi-cpu boxes (dedicated74) just because of concurrent loading. I fixed this bug in 3.2.4RC1 by synchronizing on EntityEnterpriseContext in EntitySynchronizationInterceptor. ---------------------------------------------------------------------- Comment By: Adrian Brock (ejort) Date: 2004-03-06 15:04 Message: Logged In: YES user_id=9459 This is not a bug. The spec does not define behaviour of entity beans outside a transaction. It does suggest possible solutions, including starting a transaction for every request. You will find in 3.2.3 the ReentranceInterceptor serializes access outside a transaction provided your bean is not reentrant. The 3.2.3 behaviour includes deadlock detection. Your solution has potential undetected deadlocks. Regards, Adrian ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=910911&group_id=22866 ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
