8 Replies Latest reply on Jan 28, 2005 5:51 AM by aloubyansky

    delete and insert vs update

    sysuser1

      I am trying to find a leak in my application. I am using CMP 2.x Entity Beans. with an MDB that actually performs the inserts/updates/deletes. The transaction for MDB is Bean Managed. I am using JBoss 3.2.3 and JDK 1.4.2. The memory to set to max 256MB. I have a read-ahead of 1000 and max cache size of 2000. I am using commit option B.

      In order to find the leak I have narrowed down the number beans I touch to 10.
      The test:

      update one Entity Bean A in a transaction.
      start another transaction to delete 16 Entity Bean Bs
      inserts 16 (different) Entity Bean Bs.
      Remaining 8 beans are fetched but not modified.
      commit the transaction.

      This test is performed at 120 times per minute.

      This test ran out of memory in about an hours time. I profiled the application using java profiling tools and found that bean B's count kept increasing on each iteration. Remaining 9 beans count didn't increase after the first time.

      I commented out all Bean B's operations and retested. So in this new test Bean A is still being updated. There is no leak this time. This observation made me think why should an update in CMP behave differently that delete-insert.

      I would appreciate if anybody can help me out here. I am being battling this problem for days now.

      Thanks in advance

      VM

        • 1. Re: delete and insert vs update
          aloubyansky
          • 2. Re: delete and insert vs update
            sysuser1

            Thanks for you reply.

            It is same case with me as you noted. I can provide a sample application with source if needed.

            VM

            • 3. Re: delete and insert vs update
              aloubyansky

              Since there is no a testcase attached to the issue, it would be nice if you could provide one. Thanks.

              • 4. Re: delete and insert vs update
                sysuser1

                Thanks for your reply.

                I noticed that the person who reported the bug JBAS 1255, has indeed given a test case. The attachments are at https://sourceforge.net/support/tracker.php?aid=1090921. The test is similar to mine. I will work on a test case now. If the posted test case is not sufficient, let me know, I will post mine.

                Thanks again,

                VM

                • 5. Re: delete and insert vs update
                  aloubyansky

                  I am interested in a pure CMP (w/o MDBs) testcase. I've started to look into this and so far I don't see a leak. For some time memory grows and then stays constant.

                  • 6. Re: delete and insert vs update
                    sysuser1

                    Thank you Alex, for looking into it. Unfortunately my test case includes a MDB. I will try to reproduce the problem with out MDB probably thru' a struts action. If I succeed, I will post the code.

                    Thanks,

                    VM

                    • 7. Re: delete and insert vs update
                      sysuser1

                      Alex,

                      After running my new test overnight yesterday, the application did not go out of memory.

                      In my new test I removed the MDB from my previous test and replaced it with a thread whose run() method is same as onMessage() of MDB. The thread is passed the Message in the constructor. To commit transactions I used the UserTransaction (via a lookup) instead of the MDB Context. Apart from these, there were no other changes.

                      I was not able to rule of leak, as the memory did go to the max, but I never got the "OutOfMemory" error. I will use a profiling tool to rule out leak. Based on these observations could this be a MDB + CMP issue? In my previous test, whenever I updated a CMP bean in a MDB, there was no leak and memory would never reach max. My application leaked (memory was at the max and got OutOfMemory error) only when I did an delete and insert of CMPs in a MDB.

                      Kindly advise how I can resolve this issue.

                      Thanks again,

                      VM

                      • 8. Re: delete and insert vs update
                        aloubyansky

                        I don't think it's a result of MDB + CMP combination. If there is a memory leak in JBoss, it should be either in CMP or MDB containers.

                        I tried a simple testcase with CMP and haven't seen a leak so far. See comments on the Jira issue referenced in earlier posts. User said that he doesn't see the leak even with his own testcase in the default server configuration but does see it in his own 'test' configuration. I haven't looked at it yet.

                        Please, try to narrow the testcase so that we know where to look for a bug.