Skip to content

Fix TLS unwrap buffering for large reads#15

Open
sklarsa wants to merge 1 commit intomainfrom
fix/tls-unwrap-buffering
Open

Fix TLS unwrap buffering for large reads#15
sklarsa wants to merge 1 commit intomainfrom
fix/tls-unwrap-buffering

Conversation

@sklarsa
Copy link
Copy Markdown
Contributor

@sklarsa sklarsa commented Apr 23, 2026

Summary

  • fix JavaTlsClientSocket.recv() to handle valid TLS BUFFER_OVERFLOW conditions by growing an internal unwrap-output buffer instead of failing
  • drain staged plaintext across subsequent recv() calls and harden the same overflow paths during TLS handshake processing
  • add a regression test covering the overflow-then-drain behavior

Root cause

Wide TLS QWP reads could hit Output buffer too small to fit a single TLS record because decrypted plaintext was written directly into the caller buffer and overflow was treated as impossible.

Testing

  • env JAVA_HOME=/usr/lib/jvm/java-17-openjdk mvn -f java-questdb-client/pom.xml -pl core -Dtest=JavaTlsClientSocketTest test

@RaphDal
Copy link
Copy Markdown
Collaborator

RaphDal commented Apr 23, 2026

Fails
🚫

Please update the PR title to match this format:
type(subType): description

Where type is one of:
feat, fix, chore, docs, style, refactor, perf, test, ci, revert

And: subType is one of:
build, log, core, ilp, http, conf, utils

For Example:

perf(sql): improve pattern matching performance for SELECT sub-queries

Generated by 🚫 dangerJS against cfae5fd

@sklarsa sklarsa force-pushed the fix/tls-unwrap-buffering branch from b287cb1 to cfae5fd Compare April 23, 2026 19:56
@mtopolnik
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 26 / 42 (61.90%)

file detail

path covered line new line coverage
🔵 io/questdb/client/network/JavaTlsClientSocket.java 26 42 61.90%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants