#45 Memory leak when it works with Oracle JDBC

open
nobody
5
2011-04-01
2011-04-01
Jeff Liu
No

Memory leak when it works with Oracle JDBC5. The bug is caused by the finalize() method on the proxied objects of WrappedConnection. When a WrappedConnection instance goes to finish, it could be gc collected. But when Finalizer thread tries to run the finalize() method on WrappedConnection instance. The finalize() invoke will executed by #invoke() method, which will invoke the SYNCHRONIZED Connection#isClosed() method. Then the finalizer thread and worker thread could constantly block each other. Finally, the objects in finalizing queue and all referenced objects by the WrappedConnection object couldn't be collected. Sometimes when Connections aren't so busy, the heap increasing could suspend or decrease. But otherwise, OOM at the end.

The attached image shows the stack when finalizer thread was being blocked.

Discussion

  • Jeff Liu
    Jeff Liu
    2011-04-01

    the patch to fix this bug.

     
    Attachments