Skip to main content

Toplink Essentials or Glassfish - looks like memory leaks

10 replies [Last post]
Anonymous

Hello again,
I don't know what's wrong, but everything indicates that there is some
problem with either ToplinkEssentials or Glassfish. In my case, when I
am persisting large amount of data, few/several thousands entities
using merge or persist, Glassfish takes more and more memory and
finally it runs out of resources crashing at the end with
OutOfMemoryException.

After switching from Toplink to Hibernate it worked very well, I mean
I can persist as many entities as I want and Glassfish keeps memory on
low level. However I would like to stay with TopLink as (1) it's
already integrated with Glassfish and (2) NetBeans includes
pre-configured libraries for it as well, which gives me much more time
to focus on application instead of server configuration... We've found
that in my team when my friend was trying to write an import module
which adds large amount of data from 3rd party or legacy data sources
into our application.

Is this possible there are memory leaks in ToplinkEssentials?
Did someone else bring up this subject before?

Thanks,
Witek

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
whartung
Offline
Joined: 2003-06-13

How do you upgrade TopLink outside of updating GlassFish? What's the procedure?

kolmis
Offline
Joined: 2006-12-07

> How do you upgrade TopLink outside of updating
> GlassFish? What's the procedure?

I wonder if it's enough to replace the two toplink jar files in the lib directory of glassfish. Testing with glassfish 9.1 ur1 and replacing the bundled version with the jar files from the current build, I can't tell/test behavior since my persistence.xml references an orm.xml mapping file - i am setting db schema for my entities in it - but this doesn't seem to work with the new v2 builds.

gyorke
Offline
Joined: 2005-06-21

Replacing the toplink-essentials.jar in the lib directory is all that is required to update the TopLink version in glassfish.

gyorke
Offline
Joined: 2005-06-21

Hello Witek,
What version of TopLink Essentials are you using. There have been a couple memory issues diagnosed and resolved. Are you clearing the EntityManagers after each transaction? What does your application code look like, what sequence of JPA calls are made when merging/persisting Entities? Do the memory problems exist for both merging and persisting? Is the merge() api used to 'persist' the Entities?
--Gordon

Witold Szczerba

Hello Gordon,
I cannot tell you right now how the code looks like, because that is
actually not me who was writing that module, but will try to get some
details. Right now I can tell you that entity manager was cleaned but
that did not help at all, even redeplotying the application didn't
help, we had to restart entire server to get rid of huge memory
footprint left after operation.
To tell more, problem disappeared after switching to Hibernate without
changing the code much.
The TopLink version is the one included with Sun Application Server
9.0 update 1.

I will try to write something more tomorrow. Maybe I could prepare
some small example with all sources.

Thanks for attention,
Witek

2007/2/13, glassfish@javadesktop.org :
> Hello Witek,
> What version of TopLink Essentials are you using. There have been a couple memory issues diagnosed and resolved. Are you clearing the EntityManagers after each transaction? What does your application code look like, what sequence of JPA calls are made when merging/persisting Entities? Do the memory problems exist for both merging and persisting? Is the merge() api used to 'persist' the Entities?
> --Gordon
> [Message sent by forum member 'gyorke' (gyorke)]
>
> http://forums.java.net/jive/thread.jspa?messageID=203657
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Gordon Yorke

I recommend updating TopLink to the latest version there have been some
memory improvements since UR1.
--Gordon

Witold Szczerba wrote:
> Hello Gordon,
> I cannot tell you right now how the code looks like, because that is
> actually not me who was writing that module, but will try to get some
> details. Right now I can tell you that entity manager was cleaned but
> that did not help at all, even redeplotying the application didn't
> help, we had to restart entire server to get rid of huge memory
> footprint left after operation.
> To tell more, problem disappeared after switching to Hibernate without
> changing the code much.
> The TopLink version is the one included with Sun Application Server
> 9.0 update 1.
>
> I will try to write something more tomorrow. Maybe I could prepare
> some small example with all sources.
>
> Thanks for attention,
> Witek
>
>
> 2007/2/13, glassfish@javadesktop.org :
>
>> Hello Witek,
>> What version of TopLink Essentials are you using. There have been a couple memory issues diagnosed and resolved. Are you clearing the EntityManagers after each transaction? What does your application code look like, what sequence of JPA calls are made when merging/persisting Entities? Do the memory problems exist for both merging and persisting? Is the merge() api used to 'persist' the Entities?
>> --Gordon
>> [Message sent by forum member 'gyorke' (gyorke)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=203657
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Witold Szczerba

Thanks for that tip. I am sorry I did not write yesterday and today,
but we have so much other problems we did not have time to check
anything yet.
In the mean time I discovered another disaster with TopLink which is
right now my most important problem as I cannot finish another part of
application.
If you could, please, take a look at my recent post about TopLink and
Set field troubles? I would be very graceful.

Thanks,
Witek

2007/2/15, Gordon Yorke :
> I recommend updating TopLink to the latest version there have been some
> memory improvements since UR1.
> --Gordon
>
> Witold Szczerba wrote:
> > Hello Gordon,
> > I cannot tell you right now how the code looks like, because that is
> > actually not me who was writing that module, but will try to get some
> > details. Right now I can tell you that entity manager was cleaned but
> > that did not help at all, even redeplotying the application didn't
> > help, we had to restart entire server to get rid of huge memory
> > footprint left after operation.
> > To tell more, problem disappeared after switching to Hibernate without
> > changing the code much.
> > The TopLink version is the one included with Sun Application Server
> > 9.0 update 1.
> >
> > I will try to write something more tomorrow. Maybe I could prepare
> > some small example with all sources.
> >
> > Thanks for attention,
> > Witek
> >
> >
> > 2007/2/13, glassfish@javadesktop.org :
> >
> >> Hello Witek,
> >> What version of TopLink Essentials are you using. There have been a couple memory issues diagnosed and resolved. Are you clearing the EntityManagers after each transaction? What does your application code look like, what sequence of JPA calls are made when merging/persisting Entities? Do the memory problems exist for both merging and persisting? Is the merge() api used to 'persist' the Entities?
> >> --Gordon
> >> [Message sent by forum member 'gyorke' (gyorke)]
> >>
> >> http://forums.java.net/jive/thread.jspa?messageID=203657
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> >> For additional commands, e-mail: users-help@glassfish.dev.java.net
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > For additional commands, e-mail: users-help@glassfish.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Matthew Pease

upgrade toplink dude.

On 2/15/07, Witold Szczerba
wrote:
> Thanks for that tip. I am sorry I did not write yesterday and today,
> but we have so much other problems we did not have time to check
> anything yet.
> In the mean time I discovered another disaster with TopLink which is
> right now my most important problem as I cannot finish another part of
> application.
> If you could, please, take a look at my recent post about TopLink and
> Set field troubles? I would be very graceful.
>
> Thanks,
> Witek
>
> 2007/2/15, Gordon Yorke :
> > I recommend updating TopLink to the latest version there have been some
> > memory improvements since UR1.
> > --Gordon
> >
> > Witold Szczerba wrote:
> > > Hello Gordon,
> > > I cannot tell you right now how the code looks like, because that is
> > > actually not me who was writing that module, but will try to get some
> > > details. Right now I can tell you that entity manager was cleaned but
> > > that did not help at all, even redeplotying the application didn't
> > > help, we had to restart entire server to get rid of huge memory
> > > footprint left after operation.
> > > To tell more, problem disappeared after switching to Hibernate without
> > > changing the code much.
> > > The TopLink version is the one included with Sun Application Server
> > > 9.0 update 1.
> > >
> > > I will try to write something more tomorrow. Maybe I could prepare
> > > some small example with all sources.
> > >
> > > Thanks for attention,
> > > Witek
> > >
> > >
> > > 2007/2/13, glassfish@javadesktop.org :
> > >
> > >> Hello Witek,
> > >> What version of TopLink Essentials are you using. There have been a couple memory issues diagnosed and resolved. Are you clearing the EntityManagers after each transaction? What does your application code look like, what sequence of JPA calls are made when merging/persisting Entities? Do the memory problems exist for both merging and persisting? Is the merge() api used to 'persist' the Entities?
> > >> --Gordon
> > >> [Message sent by forum member 'gyorke' (gyorke)]
> > >>
> > >> http://forums.java.net/jive/thread.jspa?messageID=203657
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > >> For additional commands, e-mail: users-help@glassfish.dev.java.net
> > >>
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > > For additional commands, e-mail: users-help@glassfish.dev.java.net
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > For additional commands, e-mail: users-help@glassfish.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

hewagn00
Offline
Joined: 2006-03-27

I also experince memeory problems when using Toplink. (9.1 Build b36-rc) I am creating an EntityManager and persist several thousand new entities within one transaction. The memory usage gets to about 1300 MB and doing a .clear() and .close() on the EntityManager does not seem to help to reduce the GF memory usage afterwards. When using OpenJPA instead of Toplink my memory usage goes up only to 400MB. So are there any plans to optimize/reduce the memory usage during a persist operation?

cprashantreddy
Offline
Joined: 2004-04-19

We have faced some issues with Glassfish's Memory consumption.

See :
1. https://glassfish.dev.java.net/issues/show_bug.cgi?id=1309
2. https://glassfish.dev.java.net/issues/show_bug.cgi?id=1771

Both these issues were promptly looked at and fixed.

What i would recommend, is to try to code-in a unit test case that would resemble what is happening in your application as it interacts with Toplink.

Both the bug reports contain source code of the unit test case i created. You can take a look at this source, if it helps you create test cases of your own that resembles your application request that consumes lot of memory.

This kind of test cases make it easy to verify that the bug exists and also clarify that you are using JPA and Toplink in a standard manner.

Additionally having these kind of test cases that validate your assumptions of a third party lib like Toplink will give you confidence when you want to upgrade/switch.

HTH
-Prashant