glassfish
  1. glassfish
  2. GLASSFISH-3596

transactions never release memory until commit, so JVM eventually crashes

    Details

    • Issuezilla Id:
      3,596
    • Status Whiteboard:
      Hide

      911Approved

      Show
      911Approved

      Description

      TopLink Essentials (tested on GFv1 and v2RC4) cannot handle large transactions,
      because it uses more and more memory and eventually makes JVM crash because of
      OutOfMemoryException.

      This is serious bug, in my company we really had to switch to Hibernate in one
      project because of this issue, there is no workaround.

      A simple case:
      -----------------
      @Stateless
      public class PersonServiceBean implements PersonServiceRemote {
      @PersistenceContext private EntityManager em;
      public PersonServiceBean() { }
      public void go() {
      for (long i=10000000; i>00; i--) {
      Person person = new Person();
      person.setId;
      person.setFirstName("firstName_"+i);
      person.setLastName("lastName_"+i);
      em.persist(person);
      if (i%10000 == 0)

      { System.out.format("%,d%n",i); em.flush(); em.clear(); }

      }
      }
      }
      -----------------

      This code will lead JVM to crash with OutOfMemoryException.

      Please, take a look at this thread:
      http://forums.java.net/jive/thread.jspa?threadID=30577

      P.S.
      Another strange thing is that when I remove the
      if (i%10000 == 0)

      {...}

      block, TopLink will never flush; of course when JVM crashes, the transaction is
      rolled back anyway, but I was expecting TopLink to periodically flush data by
      itself without need for manually invoking em.flush() method (this is only my
      observation and I am not sure if this particular behavior can be considered as a
      bug).

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6603567>

        Show
        gfbugbridge added a comment - <BT6603567>
        Hide
        pkrogh added a comment -

        Changing target.

        Show
        pkrogh added a comment - Changing target.
        Hide
        sridatta added a comment -

        will be investigated for gf v2 ur1

        Show
        sridatta added a comment - will be investigated for gf v2 ur1
        Hide
        ailitche added a comment -

        Issue number: 3596
        Obtained from: TopLink
        Submitted by: ailitche
        Reviewed by: TopLink team
        Defined a new FlushClearCache property. Default value DropInvalidate drops the
        entity manager cache on flush/clear and on commit invalidates in the shared
        cache classes of updated and deleted objects. Result: the user's test, which
        threw OutOfMemory exception now should successfully pass without any change.
        new class:
        oracle.toplink.essentials.config.FlushClearCache;
        updated classes:
        oracle.toplink.essentials.config.TopLinkProperties;
        oracle.toplink.essentials.internal.ejb.cmp3.base.PropertiesHandler;
        oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork;
        oracle.toplink.essentials.internal.sessions.AbstractSession;
        oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet.
        tests:
        oracle.toplink.testing.tests.cmp3.advanced.EntityManagerJUnitTestSuite:
        testClearWithFlush2 and testMassInsertFlushClear

        Show
        ailitche added a comment - Issue number: 3596 Obtained from: TopLink Submitted by: ailitche Reviewed by: TopLink team Defined a new FlushClearCache property. Default value DropInvalidate drops the entity manager cache on flush/clear and on commit invalidates in the shared cache classes of updated and deleted objects. Result: the user's test, which threw OutOfMemory exception now should successfully pass without any change. new class: oracle.toplink.essentials.config.FlushClearCache; updated classes: oracle.toplink.essentials.config.TopLinkProperties; oracle.toplink.essentials.internal.ejb.cmp3.base.PropertiesHandler; oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork; oracle.toplink.essentials.internal.sessions.AbstractSession; oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet. tests: oracle.toplink.testing.tests.cmp3.advanced.EntityManagerJUnitTestSuite: testClearWithFlush2 and testMassInsertFlushClear
        Hide
        ailitche added a comment -

        Checked in correction to the previous fix to this issue.
        updated classes:
        oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork;
        oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet.
        updated test:
        oracle.toplink.testing.tests.cmp3.advanced.EntityManagerJUnitTestSuite.testMassI
        nsertFlushClear

        Why this correction? The same fix was checked into TopLink and caused
        deterioration of some performance tests.

        Show
        ailitche added a comment - Checked in correction to the previous fix to this issue. updated classes: oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork; oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet. updated test: oracle.toplink.testing.tests.cmp3.advanced.EntityManagerJUnitTestSuite.testMassI nsertFlushClear Why this correction? The same fix was checked into TopLink and caused deterioration of some performance tests.
        Hide
        basler added a comment -

        Approved for check into the SJSAS91_FCS_BRANCH

        Show
        basler added a comment - Approved for check into the SJSAS91_FCS_BRANCH

          People

          • Assignee:
            tware
            Reporter:
            pljosh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: