pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: embuc (@embuc) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3089: Metaspace Memory leak: Thread.inheritedAccessControlContext
Date: Tue, 09 Jan 2024 13:56:41 +0000
Message-ID: <[email protected]> (raw)

**Describe the issue**
After update to driver version > 42.6.0 (tested also both released version up to latest released 42.7.1) we started to notice memory leaks connected to re-deploys of web-apps in Apache Tomcat (ver 9.0.80). I inspected heap dumps and found the instances of org.postgresql.util.LazyCleaner retained in Metaspace i.e. with path to GC roots with excluded phantom/weak/soft/etc references. Regression seem to have happened with release of 42.6.0 version. Downgraded to 42.5.4 - after excessive testing - no leaks in Metaspace and everything was released correctly. Perhaps this has to do something with [fix 2817](https://github.com/pgjdbc/pgjdbc/pull/2817) and/or [fix 2847 ](https://github.com/pgjdbc/pgjdbc/pull/2847)? I didn't have time to investigate more but it should be hopefully enough to point the experts in right direction.    

**Driver Version?** 
42.6.0
**Java Version?**
17
**OS Version?**
Ubuntu 22.04
**PostgreSQL Version?**
14
**To Reproduce**
Steps to reproduce the behaviour:
Re-deploy .war files in Apache Tomcat. 
**Expected behaviour**
GC should be able to clean Metaspace when classes are unloaded (as with deploy).
And what actually happens:
Old Classloader is bound with reference from LazyCleaner thus preventing GC to remove it. 

**Logs**
If possible PostgreSQL logs surrounding the occurrence of the issue (N/A)


view thread (49+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3089: Metaspace Memory leak: Thread.inheritedAccessControlContext
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox