pg.ddx.io  GitHub: pgjdbc/pgjdbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: sankalpsthakur (@sankalpsthakur) <noreply+sankalpsthakur@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: [pgjdbc/pgjdbc] PR #4332: fix: limit FINEST Bind, Parse and SimpleQuery log messages to maxLogMessageLength to avoid OOM
Date: Sat, 01 Aug 2026 09:16:31 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4332@github.com> (raw)

### 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?

### Changes to Existing Features:

* [x] Does this break existing behaviour? If so please explain.
  * Behaviour change only when FINEST protocol dumps would exceed **16384** characters (new default). Truncated messages end with `...(truncated)`. Set `maxLogMessageLength=0` for the previous unlimited dumps.
* [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?

## Summary

Fixes #995; FINEST Bind dumps with many/large parameters could allocate unbounded strings and OOM while logging.

### Changes
- New connection property **`maxLogMessageLength`** (default `16384`, `0` = unlimited)
- Cap `FE=> Bind(...)` dumps via `BindLog` (stop appending params once the budget is exhausted; skip materializing individual values larger than the remaining budget)
- Limit `FE=> Parse(...)` and `FE=> SimpleQuery(...)` traces the same way; a negative value is rejected
- DataSource getter/setter + docs

### Tests
```
./gradlew :postgresql:test \
  --tests 'org.postgresql.util.internal.LogMessageUtilsTest' \
  --tests 'org.postgresql.core.v3.BindLogTest' \
  --tests 'org.postgresql.test.jdbc2.PGPropertyTest' \
  --tests 'org.postgresql.test.jdbc2.MaxLogMessageLengthTest'
```
Also ran `:postgresql:checkstyleMain` / `checkstyleTest`.

### AI/LLM disclosure

- AI coding tools (Codex and Claude Code) were used to help draft or modify code and this PR description.



view thread (58+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-4332@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-4332@github.com/

 · 


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