You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Hans J. Prueller" <ha...@gmx.net> on 2007/03/28 22:08:17 UTC

RE: WARNING: Connection not closed by caller - messages producedbyOpenJPA?

Am Mittwoch, den 28.03.2007, 12:43 -0700 schrieb Patrick Linskey:

> What happens if you set 'openjpa.TransactionMode' to 'managed' as
> well?


I will give it a try. Can you explicitly confirm that it shouldn't be a
multithreading problem where there are serveral entitymanagers
created in different JTA transactions running in parallel? e.g.

TX A starts
EM A created
A working
TX B starts
EM B created
A and B working
(this is where we currently get the errors)
...

> 
> Also, are you closing your EMs at the end of the transaction? 


not really. the problem is that we have serveral methods calling each
other - each of it creating its own EM at the beginning. (which
will be the same EM instance regarding to the lookup code we
implementend - see previous mail). So close() of a sub-method would
call the "outer"     methods EM too I guess?

Hans

RE: WARNING: Connection not closed by caller -messagesproducedbyOpenJPA?

Posted by Patrick Linskey <pl...@bea.com>.
> As I mentioned, there is a static EMF in a helper class used 
> to obtain the EM's called from different
> threads. does above property also resolve multithreaded 
> access to the EMF? 

No. The EMF is always thread-safe (or should be, at least).

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Wednesday, March 28, 2007 10:10 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: WARNING: Connection not closed by caller 
> -messagesproducedbyOpenJPA?
> 
> >> If you want to access a single EM from multiple
> >> threads, you should set the openjpa.Multithreaded property 
> accordingly
> 
> As I mentioned, there is a static EMF in a helper class used 
> to obtain the EM's called from different
> threads. does above property also resolve multithreaded 
> access to the EMF? 
> 
> Hans
> 
> Am Mittwoch, den 28.03.2007, 13:30 -0700 schrieb Patrick Linskey: 
> 
> 	
> 	> I will give it a try. Can you explicitly confirm that it 
> 	> shouldn't be a multithreading problem where there are 
> 	> serveral entitymanagers
> 	> created in different JTA transactions running in 
> parallel? e.g.
> 	
> 	Assuming that the different JTA transactions are on 
> different threads,
> 	and that you do not try to access one EM from multiple 
> threads, there
> 	should be no problem. (If you want to access a single 
> EM from multiple
> 	threads, you should set the openjpa.Multithreaded 
> property accordingly.)
> 	
> 	Also, it would be useful to see a JDBC trace-level log 
> of the system
> 	running through a couple of transactions. That might 
> give us an idea of
> 	how things are working.
> 	
> 	Are you ever sharing EMs across multiple sequential JTA 
> transactions?
> 	
> 	-Patrick
> 	
> 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

RE: WARNING: Connection not closed by caller - messagesproducedbyOpenJPA?

Posted by "Hans J. Prueller" <ha...@gmx.net>.
>> If you want to access a single EM from multiple
>> threads, you should set the openjpa.Multithreaded property
accordingly

As I mentioned, there is a static EMF in a helper class used to obtain
the EM's called from different
threads. does above property also resolve multithreaded access to the
EMF? 

Hans

Am Mittwoch, den 28.03.2007, 13:30 -0700 schrieb Patrick Linskey:

> > I will give it a try. Can you explicitly confirm that it 
> > shouldn't be a multithreading problem where there are 
> > serveral entitymanagers
> > created in different JTA transactions running in parallel? e.g.
> 
> Assuming that the different JTA transactions are on different threads,
> and that you do not try to access one EM from multiple threads, there
> should be no problem. (If you want to access a single EM from multiple
> threads, you should set the openjpa.Multithreaded property accordingly.)
> 
> Also, it would be useful to see a JDBC trace-level log of the system
> running through a couple of transactions. That might give us an idea of
> how things are working.
> 
> Are you ever sharing EMs across multiple sequential JTA transactions?
> 
> -Patrick
> 

RE: WARNING: Connection not closed by caller -messagesproducedbyOpenJPA?

Posted by Patrick Linskey <pl...@bea.com>.
> I.e. 2 different threads accessing the EMF to create the EM 
> in parallel could be the cause of the problem?

That should not be a problem.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Wednesday, March 28, 2007 10:00 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: WARNING: Connection not closed by caller 
> -messagesproducedbyOpenJPA?
> 
> Am Mittwoch, den 28.03.2007, 13:30 -0700 schrieb Patrick Linskey:
> 
> 
> 	Are you ever sharing EMs across multiple sequential JTA 
> transactions?
> 	
> 
> 
> As far as I can say: definitely NO. But the EMF used to 
> create the EM's is held as a static member of a Helper Class.
> I.e. 2 different threads accessing the EMF to create the EM 
> in parallel could be the cause of the problem?
> 
> Hans 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

RE: WARNING: Connection not closed by caller - messagesproducedbyOpenJPA?

Posted by "Hans J. Prueller" <ha...@gmx.net>.
Am Mittwoch, den 28.03.2007, 13:30 -0700 schrieb Patrick Linskey:

> Are you ever sharing EMs across multiple sequential JTA transactions?


As far as I can say: definitely NO. But the EMF used to create the EM's
is held as a static member of a Helper Class.
I.e. 2 different threads accessing the EMF to create the EM in parallel
could be the cause of the problem?

Hans

RE: WARNING: Connection not closed by caller - messagesproducedbyOpenJPA?

Posted by Patrick Linskey <pl...@bea.com>.
> I will give it a try. Can you explicitly confirm that it 
> shouldn't be a multithreading problem where there are 
> serveral entitymanagers
> created in different JTA transactions running in parallel? e.g.

Assuming that the different JTA transactions are on different threads,
and that you do not try to access one EM from multiple threads, there
should be no problem. (If you want to access a single EM from multiple
threads, you should set the openjpa.Multithreaded property accordingly.)

Also, it would be useful to see a JDBC trace-level log of the system
running through a couple of transactions. That might give us an idea of
how things are working.

Are you ever sharing EMs across multiple sequential JTA transactions?

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Hans J. Prueller [mailto:hans.prueller@gmx.net] 
> Sent: Wednesday, March 28, 2007 1:08 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: WARNING: Connection not closed by caller - 
> messagesproducedbyOpenJPA?
> 
> Am Mittwoch, den 28.03.2007, 12:43 -0700 schrieb Patrick Linskey:
> 
> 
> 	What happens if you set 'openjpa.TransactionMode' to 
> 'managed' as well?
> 	
> 
> 
> I will give it a try. Can you explicitly confirm that it 
> shouldn't be a multithreading problem where there are 
> serveral entitymanagers
> created in different JTA transactions running in parallel? e.g.
> 
> TX A starts
> EM A created
> A working
> TX B starts
> EM B created
> A and B working
> (this is where we currently get the errors)
> ...
> 
> 
> 
> 	Also, are you closing your EMs at the end of the transaction? 
> 	
> 
> 
> not really. the problem is that we have serveral methods 
> calling each other - each of it creating its own EM at the 
> beginning. (which
> will be the same EM instance regarding to the lookup code we 
> implementend - see previous mail). So close() of a sub-method would
> call the "outer"     methods EM too I guess?
> 
> Hans 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.