pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3530: JDBC Shared Timer set to cancelled
Date: Mon, 24 Feb 2025 05:53:12 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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-`...

view thread (17+ 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 #3530: JDBC Shared Timer set to cancelled
  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