pgjdbc/pgjdbc GitHub issues and pull requests (mirror)help / color / mirror / Atom feed
[pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… 8+ messages / 3 participants [nested] [flat]
* [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 03:37 "bilalshehata (@bilalshehata)" <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 03:37 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> (first open source contribution to this repo just fixing a bug that was really bothering me - any feedback is appreciated ) Trying to fix this bug http://github.com/pgjdbc/pgjdbc/issues/194 The driver has a hardcoded 64KB threshold (`MAX_BUFFERED_RECV_BYTES`) for deciding when to flush during batch execution. The idea is to avoid a deadlock where both sides block waiting for the other to drain their buffers. But if the actual OS socket receive buffer is smaller than 64KB, the driver pipelines too many queries before flushing and you still get the deadlock. This reads the real socket receive buffer size at connection time and uses that as the threshold instead. If it can't be read, it falls back to the old 64KB default. ### All Submissions: * [x] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document? * [x] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change? <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### New Feature Submissions: 1. [x] Does your submission pass tests? 2. [x] Does `./gradlew styleCheck` pass ? 3. [x] Have you added your new test classes to an existing test suite in alphabetical order? ### Changes to Existing Features: * [x] Does this break existing behaviour? If so please explain. * [x] Have you added an explanation of what your changes do and why you'd like us to include them? * [x] Have you written new tests for your core changes, as applicable? * [x] Have you successfully run tests with your changes locally? ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 09:43 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 09:43 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> @davecramer wondering if you could retrigger the CI for this one, just needed to adjust my unit test ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 09:58 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 09:58 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> @davecramer i removed the before test entirely, the deadlock doesn't seem to be reliably reproducable in all environments, I assume the CI has some sort of loop back networking which makes it behave differently to real world behaviours. I have left the post-fix tests in place ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 09:59 ` "davecramer (@davecramer)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: davecramer (@davecramer) @ 2026-04-08 09:59 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> (on pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchDeadlockTest.java) change this to 2026 ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 10:00 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 10:00 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> (on pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchDeadlockTest.java) Done 👍 ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 10:03 ` "vlsi (@vlsi)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: vlsi (@vlsi) @ 2026-04-08 10:03 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> (on pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchDeadlockTest.java:191) Can we avoid private/final field modification in tests? ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 11:46 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 11:46 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> @davecramer could you rerun the test suite, thanks! ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… @ 2026-04-08 12:16 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 12:16 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> @vlsi that is a good point, let me reconsider the approach -> I Suspect maybe we can make Pgstatement code more precise about the buffers rather than having to do this guess work when it comes to flushing the buffers ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2026-04-08 12:16 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-08 03:37 [pgjdbc/pgjdbc] PR #4013: fix: initialize maxBufferedRecvBytes from actual socket receive buffe… "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 09:43 ` "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 09:58 ` "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 09:59 ` "davecramer (@davecramer)" <[email protected]> 2026-04-08 10:00 ` "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 10:03 ` "vlsi (@vlsi)" <[email protected]> 2026-04-08 11:46 ` "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 12:16 ` "bilalshehata (@bilalshehata)" <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox