Thanks Alex,
I think you hit the nail on the head. That explains why my test app only
works when the entities are wrapped in a transaction, and also explains why
I was getting reentrance errors on finder methods in JBoss 3.0.4 / 3.0.7. I
have also had this problem with entity beans deployed as "1.x" CMP, but I
guess I can't expect perfect backward compatibility.
Thanks!
Mike
----- Original Message -----
From: "Alexey Loubyansky" <[EMAIL PROTECTED]>
To: "Michael Jara" <[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 2:39 AM
Subject: Re: [JBoss-user] Re: "Reentrant method call detected" on Concurrent
Entity Access
Hello Michael,
Accessing entity beans w/o tx is considred bad by the EJB2.0 spec.
"For entity beans that use EJB 2.0 container-managed persistence, only the
Required,
RequiresNew, or Mandatory transaction attributes should be used for the
methods defined in the
bean's component interface and all the direct and indirect superinterfaces
of the component interface,
excluding the getEJBHome, getEJBLocalHome, getHandle, getPrimaryKey, and
isIdentical
methods; and for the methods defined in the bean's home interface and all
the direct and
indirect superinterfaces of the home interface, excluding the getEJBMetaData
and getHomeHandle
methods specific to the remote home interface. Containers may optionally
support the use of the
NotSupported, Supports, and Never transaction attributes for the methods of
entity beans with
container-managed persistence. However, entity beans with container-managed
persistence that use
these transaction attributes will not be portable.
Containers may optionally support the use of the NotSupported, Supports, and
Never
transaction attributes for the methods of entity beans with
container-managed persistence
because the use of these transaction modes may be needed to make use of
container-managed
persistence with non-transactional data stores. In general, however, the
Application Assembler
should avoid use of the NotSupported, Supports, and Never transaction
attributes for
the methods of entity beans with container-managed persistence because it
may lead to inconsistent
results or to the inconsistent and/or to the partial updating of persistent
state and relationships
in the event of concurrent use."
alex
Monday, August 04, 2003, 5:47:41 AM, Michael Jara wrote:
> (I must've accidentally pressed some sequence of keys that mean "send
> message". Sorry about that. :)
> The only way I've been able to avoid this concurrency problem has been to
> set a transaction on the stateless session bean, or on the entity bean.
If
> I put it on the SB, than only one client can get the data at a time.
(I've
> tried changing "jboss.xml" to alter the locking behavior, but didn't have
a
> lot of luck with that.) If I put it on the entity bean, well, seems like
a
> lot of overhead for a read-only method. Besides that, in the past I've
run
> into deadlock issues when I haven't been very careful about transaction
> use...
> So, any suggestions? If you have any ideas, I'd be happy to send you send
> you my code. (It's not generated with XDoclet, so I don't want to go
> posting it all here.) I'd be surprised if this really is a JBoss bug,
> because I can't imagine something this critical slipping by everyone for
so
> long! I really don't want to revert my app to use JBoss 2.2.2 again, so
any
> help is appreciated.
> Thanks!
> Mike
> ----- Original Message -----
> From: "Michael Jara" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, August 03, 2003 7:38 PM
> Subject: "Reentrant method call detected" on Concurrent Entity Access
>> I've been wrestling with a problem for almost a week now, and I'm hoping
>> someone may have some insight into this...
>>
>> In porting our application from JBoss 2.2.2 to JBoss 3.2.1, I've found
> what
>> seems to be a major concurrency bug in JBoss. The app consists of a
> session
>> bean acting as a facade for a set of entity beans. Running one client
>> instance, the application works perfectly. Running two or more clients
at
>> the same time, I get an EJBException for at least one of the clients
> stating
>> "Reentrant method call detected". In an effort to troubleshoot this
>> problem, created a small test application to replicate it... Here are
the
>> details:
>>
>> Application Contents:
>>
>> - One simple CMP2.0 entity bean with local interfaces.
>> - One stateless session bean.
>> - EJB application client.
>>
>> App Functionality:
>>
>> 1. Client creates an instance of the stateless session bean.
>> 2. Client calls a "getAll" method on the stateless session bean.
>> 3. SSB performs a "findAll" on the entity bean.
>> 4. SSB iterates through the finder's collection and extracts a value
> object
>> from each entity.
>> 5. SSB returns an array of these value objects to the client.
>>
>> EJB / JBoss Config:
>>
>> - SSB has no transactions ("NotSupported").
>> - Entity "Supports" transactions (though none are used.)
>> - Read-ahead strategy "none" (set in "jbosscmp-jdbc.xml").
>> - JBoss "default" configuration, no mucking with "standardjboss.xml" or
>> "jboss.xml". (This means pessimistic locking, I believe.)
>>
>> What happens:
>>
>> 1. I start by adding 500 instances of the entity.
>> 2. Run two clients in separate threads at the same time... (Running them
> in
>> one VM makes the problem about 90% repeatable. Running them in separate
>> processes is less repeatable, presumably due to timing, but I've seen the
>> problem that way too.)
>> 3. One client fails. Relevant portions of server log (annotated):
>>
> ... snip ...
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
>
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user