Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Mon, 24 Feb 2025 05:53:12 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3530: JDBC Shared Timer set to cancelled In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 2677493817 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3530 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3530#issuecomment-2677493817 Content-Type: text/plain; charset=utf-8 Even though OOM is hard to recover from, it is worth double-checking if there's a bug with Timer sharing logic. @jamesagnew , do OOM stacktraces have anything to do with pgjdbc? Frankly, it looks like we release the timer in two cases: an explicit connection close or a connection close triggered by leak detector. In both cases, we cancel the shared if `refCount.decrementAndGet()` returns `0`. We have `refCount.incrementAndGet()` in `getTimer()`, so I do not see a bug there. --- At the same time, it looks like `java.util.Timer` cancels if any task throws an uncaught exception. It might indeed be the case, however, `org.postgresql.jdbc.StatementCancelTimerTask#run` ignores `SQLException`, so it should be more-or-less safe.. Could you please double-check if there's an uncaught exception from the timer thread? It could be something like `Exception in thread "PostgreSQL-JDBC-SharedTimer-`...