8 Replies Latest reply on Aug 21, 2008 8:11 PM by sairamvla

    PermGen leak when passing detached entities over remote inte

    stnor

      We're getting quite an insane amount of PermGen memory leaking when passing detached entities back to the server over Remote Proxies.

      No memory leaks when using @EJB to @Local interfaces, only @Remote beans have this issue.

      Anyone else getting this? Seem to be javassist that loads new classes for each remote call?

      EJB3 rc9 on 4.0.4.

      Thanks,

      Stefan

        • 1. Re: PermGen leak when passing detached entities over remote
          dcracauer

          I think we're seeing it too. I have a process that I can run that makes my server use up 128m of PermGen space in about an hour. I haven't put together a test case I can send to JBoss yet. Do you have one?

          • 2. Re: PermGen leak when passing detached entities over remote
            clebert.suconic

            Is it possible you provide the testcase?

            I have tried replicating this and I didn' t have much success. (just assumed it wasn' t a bug)

            I won' t be working on this issue any more, but someone from Hibernate/EJB3 would certainly be involved.


            Clebert

            • 3. Re: PermGen leak when passing detached entities over remote
              stnor

              I can try to get a testcase on this. I spent an hour tring last week but had no success.

              • 4. Re: PermGen leak when passing detached entities over remote
                pmpm

                I also have observed this leak, take a look at this topic:
                http://www.jboss.org/index.html?module=bb&op=viewtopic&t=84255

                As far as I observed, the leak is caused by the following sequence of operations:
                - querying server for entities and obtaining them via rmi to the remote java client
                - constucting new entity having collection of those detached entities on the client side
                - sending object with the collection to the server and persisting it (detached entities are reloaded into current session with EntityManager.find() or getReference)

                Pawel Miniewicz

                • 5. Re: PermGen leak when passing detached entities over remote
                  stnor

                  Is there anyone working on fixing this? JIRA id?

                  • 6. Re: PermGen leak when passing detached entities over remote
                    ptabor

                    I got the same problem...
                    PermGen in EJB3 client aplication by remote interface.
                    The application is as sample as it can be:
                    -get remote interface of stateless EJB3 (by JNDI)
                    - ask 1000 times to get a Collection of 10 EntityBeans.

                    After 255 there is OutOfMemory: PermGen.
                    JVM options changes nothing (eventualy more PermSpace => longer run).

                    The reason looks like the Javassist create lazyinitializer classes for every EntityBean retrived from the server.

                    So: When I debug on server-side, I got before sending Entity to client:
                    I got:
                    myEntity[0].id=143534
                    myEntity[0].flow=<FlowEntity_$$_javassist_7> 13434
                    ...
                    myEntity[0].user=<UserEntity_$$_javassist_15>...
                    myEntity[0].stage=<StageEntity_$$_javassist_17>...

                    And every remote call the class names (name)_$..._javassist_(index) got the same
                    indexes (7,15,17) on server side (end every entity in returned collections of entities)

                    But when I debug on client site - after return from remote call - the indexes of
                    all returned entities are different (Each next increments index).

                    So after first call I got:

                    myEntity[0].id=143534
                    myEntity[0].flow=<FlowEntity_$$_javassist_0>...
                    ...
                    myEntity[0].user=<UserEntity_$$_javassist_1>...
                    myEntity[0].stage=<StageEntity_$$_javassist_2>...
                    ...
                    myEntity[1].id=143534
                    myEntity[1].flow=<FlowEntity_$$_javassist_3>
                    ...
                    myEntity[1].user=<UserEntity_$$_javassist_4>...
                    myEntity[1].stage=<StageEntity_$$_javassist_5>...
                    ...

                    After secund call:


                    myEntity[0].id=143534
                    myEntity[0].flow=<FlowEntity_$$_javassist_6>...
                    ...
                    myEntity[0].user=<UserEntity_$$_javassist_7>...
                    myEntity[0].stage=<StageEntity_$$_javassist_8>...
                    ...
                    myEntity[1].id=143534
                    myEntity[1].flow=<FlowEntity_$$_javassist_9>
                    ...
                    myEntity[1].user=<UserEntity_$$_javassist_10>...
                    myEntity[1].stage=<StageEntity_$$_javassist_11>...
                    ...


                    And so on... ... and permGen after 260 iterations...

                    I have not idea, how to deal with that...

                    • 7. Re: PermGen leak when passing detached entities over remote
                      ptabor
                      • 8. Re: PermGen leak when passing detached entities over remote
                        sairamvla

                        Sorry for asking now.

                        Is any body had a solution for this? I am into same situation now.