Subject: [pgjdbc/pgjdbc] PR #3960: fix: release COPY lock on IOException to prevent connection hang (#3957)

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 13 Mar 2026 17:16:37 +0000

When an IOException occurs during COPY operations (endCopy, writeToCopy, flushCopy, readFromCopy), the COPY lock was not released, causing all subsequent operations on the connection (e.g. isValid, rollback) to hang indefinitely in waitOnLock(). This matches the existing pattern in cancelCopy() which already releases the lock in its finally block.

Also adds closeAllClients() to StrangeProxyServer for triggering immediate IOExceptions in tests.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 13 Mar 2026 20:05:13 +0000

I approve, it would be nice to somehow make this cleaner using autocloseble, but this works