TIKA-4793: make Pipes IPC payload limit configurable#2962
Open
srujana-kuntumalla wants to merge 4 commits into
Open
TIKA-4793: make Pipes IPC payload limit configurable#2962srujana-kuntumalla wants to merge 4 commits into
srujana-kuntumalla wants to merge 4 commits into
Conversation
The hard-coded 100 MB ceiling in PipesMessage was not operator-tunable. Add PipesConfig.maxIpcPayloadBytes (default 100 MB) and thread it through PipesClient, PipesServer, ConnectionHandler, and ServerProtocolIO so the limit is applied on every read() call. The write path is unchanged. Includes unit tests for default value, JSON loading, and validation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
@tballison @THausherr Can you please review this PR? TIA |
Contributor
|
My agent recommends these four small changes. wdyt? |
Contributor
|
Other thing is that tika-pipes was designed to emit rather than passing back to the pipesclient? What's your use case where you're passing back that much data? |
Contributor
|
K, this one is more important. We should surface the source of the problem when a payload is too big, and we don't want to have to restart a pipesserver when this is hit. |
Remove final from PipesMessage.MAX_PAYLOAD_BYTES (long) so it can be set at runtime. PipesConfig.setMaxIpcPayloadBytes() updates the static whenever the limit is changed via JSON config or programmatically. No changes to call sites — all existing PipesMessage.read() callers pick up the new value automatically through the shared static. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove final from PipesMessage.MAX_PAYLOAD_BYTES so it can be updated
at runtime. Add maxIpcPayloadBytes to PipesConfig (int, default 100 MB)
with a setter that updates PipesMessage.MAX_PAYLOAD_BYTES as a side
effect. Both client and server JVMs load from the same tika-config.json
so setting it once covers both ends automatically. No changes to call
sites — all existing PipesMessage.read() callers pick up the value
through the shared static.
Configurable via tika-config.json:
{"pipes": {"maxIpcPayloadBytes": 209715200}}
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
I have updated the PR to keep the changes minimal to allow max payload size to be configurable. |
Contributor
|
I agree with my claude on this one. Seriously, thank you for opening this and iterating on it. |
…_EXCEEDED status - Restore MAX_PAYLOAD_BYTES to final; add read(DataInputStream, int) overload so callers can pass a per-connection limit without mutating shared state - PipesConfig setter no longer has the global side-effect; PipesClient captures maxIpcPayloadBytes at construction and passes it to read() in waitForServer() - Add PAYLOAD_LIMIT_EXCEEDED(TASK_EXCEPTION) to RESULT_STATUS so oversized responses are treated as per-document errors, not process crashes - Introduce PayloadLimitExceededException (IOException subtype) and catch it specifically in PipesClient: close the desynchronized connection but do not restart the healthy server - Add JSON zero-value rejection test through the deserialization path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Appreciate the feedback! I have updated the PR with threaded limit and PAYLOAD_LIMIT_EXCEEDED status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hard-coded 100 MB ceiling in PipesMessage was not operator-tunable. Add PipesConfig.maxIpcPayloadBytes (default 100 MB) and thread it through PipesClient, PipesServer, ConnectionHandler, and ServerProtocolIO so the limit is applied on every read() call. The write path is unchanged. Includes unit tests for default value, JSON loading, and validation.
Thanks for your contribution to Apache Tika! Your help is appreciated!
Before opening the pull request, please verify that
TIKA-XXXX)[TIKA-XXXX] Issue or pull request title)./mvnw clean testmainbranch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulledmainbranchtika-bom/pom.xml.We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the Tika mailing list. Thanks!