Forum Stats

  • 3,827,834 Users
  • 2,260,826 Discussions
  • 7,897,395 Comments

Discussions

memory leak within their JAVA code

Danv-Oracle
Danv-Oracle Member Posts: 7
edited Jan 25, 2016 2:45AM in New To Java

PROBLEM:

The customer is having a problem with a memory leak within their JAVA application.  Something this is not supported by Oracle Support though an SR.

INITIAL FINDING:  they didn't use the free() when using the getclobval(). 

INITIAL SOLUTION: The customer changed their code to add in the free() and this reduced the leak but not all of it.  80-90% of the leak is gone

CURRENT ISSUE: We examined the latest heapdump and it still had the same signature as before, so we asked them to re-exam their code.

They couldn't find anything in the code so the next idea is to trace file JAVA application in hope to locating the memory leak and the location where they need a free() call.

JDK 1.6

Database 11.2.0.4

Red Hat Linux

Connection pooling

EXIT CRITERIA:  Reduce the leak by 99-100%

--------MORE DETAIL-------------------------

By examining the headdump from an 11.2.0.4 database, we can see the leak and with the help of Oracle JAVA support initially identified it was related to customer Code NOT using the free() when using the getclobval() function.

---Description provided to the customer in the SR----------------

The Heapdumps from Production confirmed last week was that the Statements that we were focussing on were not triggering leaks from the same areas as what is being seen on your Production environment.
Even if we fix the issue seen on the statements included in the standalone testcase , it is not even a factor on your Production JDBC sessions.

As I had indicated in my earlier update , the Production connection pooled sessions are still showing close to 90% of its leaks in the "koh dur heap d" / "qmxtgCrBufClob" heaps.
Memory allocations from this heap is usually done when using :
a) getclobval()  and a corresponding free() is not called.
b) XMLSERIALIZE
c) dbms_xmlschema.inPlaceEvolve

My preference would be to defer tracing ( being a last resort and a hit-and-miss approach ) and instead work with customer's Development Team to check if a code walkthrough reveals any other instances where getclobVals() are called and the corresponding free() is not called.
If it comes down to tracing , we can pick up a few top sessions and get Memory Snapshots before and after an hour's duration and hopefully we can find the statements of interest.

--------end-------------------------

The customer has NOT been able to locate the getclobval() and corresponding free() mismatch in their code.  So they want to attempt to trace their application to pinpoint the segment of code causing the problem.

***** QUESTION for this group ********

We are at the last resort and need to trace to help the customer locate their leak.  The JAVA support group pointed us to “How to Troubleshoot Native Memory Leak in Java Applications on Solaris (Doc ID 1320890.1)” and possibly using matrace and libnjamd tools.  We are not JAVA experts and need some guidance or exact commands to help guide the customer on how best to trace their code.

Customer would like to test this tracing as soon as Tuesday 12/22.

Any help would be appreciated!

Message was edited by: Danv-Oracle

Answers

  • Unknown
    edited Dec 19, 2015 4:46PM
    We are at the last resort and need to trace to help the customer locate their leak.  The JAVA support group pointed us to “How to Troubleshoot Native Memory Leak in Java Applications on Solaris (Doc ID 1320890.1)” and possibly using matrace and libnjamd tools.  We are not JAVA experts and need some guidance or exact commands to help guide the customer on how best to trace their code.
    
    Customer would like to test this tracing as soon as Tuesday 12/22.
    
    Any help would be appreciated!
    

    Unfortunately we can't help you because you never told us WHAT PROBLEM you, or the customer, is having.

    Start over and provide the detail about the actual problem.

    All you said was that an SR was opened and support responded with some info.

    But nowhere in your post did you actually DESCRIBE the problem

    1. WHAT is the client doing?

    2. HOW are they doing it?

    3. WHAT result are they getting?

    4. WHAT result do they expect to get

    5. What os/version and java version are they using?

    6. Is a database involved? If so what is the database name and version and what is the JDBC jar file name and version?

  • Unknown
    edited Dec 21, 2015 11:59AM

    Ok - you updated SOMETHING in your post but you still haven't provided ANY of the info ask for that is needed to help you.

    Without that info no help is available.

    Danv-Oracle
  • Kevin Hooke
    Kevin Hooke Member Posts: 16
    edited Jan 19, 2016 7:04PM

    Are you sure you are talking about a memory leak in Java code? You mention " they didn't use the free() when using the getclobval()" but this doesn't look like any Java api that I'm familiar with. As one of the other replies mentioned, you need to give more info on the exact nature of the problem.

  • Danv-Oracle
    Danv-Oracle Member Posts: 7
    edited Jan 19, 2016 8:17PM

    Thanks for your help.  I think I will not post again until I become a better JAVA programmer.  It seems I was knowledgeable enough to explain what was happening.

    The customer has resolved this issue by restarting their middle tier to clear the connection pool which in turn releases the memory within the database.  It's a work around but they are no longer willing to invest the time to investigate it any further.

    Thanks for taking the time to post to my question.

    Dan

  • jwenting
    jwenting Member Posts: 4,864 Gold Badge
    edited Jan 25, 2016 2:45AM

    in other words there is a problem in your database access code that causes it to not release some resources (either connections, cursors, or whatever).

    That seems pretty obvious from your last statement, and is a common cause of problems in JDBC code written by people whose sole knowledge of how to write database code comes from fundamentally flawed tutorials (most of which omit that tiny little detail (that you have to actively release database resources in your Java code) for brevity.

This discussion has been closed.