TIKA-4793: make Pipes IPC payload limit configurable - #2962
TIKA-4793: make Pipes IPC payload limit configurable#2962srujana-kuntumalla wants to merge 5 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>
|
@tballison @THausherr Can you please review this PR? TIA |
|
My agent recommends these four small changes. wdyt? |
|
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? |
|
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>
|
I have updated the PR to keep the changes minimal to allow max payload size to be configurable. |
|
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>
|
Appreciate the feedback! I have updated the PR with threaded limit and PAYLOAD_LIMIT_EXCEEDED status |
|
I concur with my 🤖 2. /**
* Thrown when an incoming IPC payload's declared length exceeds the configured
* limit (see {@link org.apache.tika.pipes.core.PipesConfig#getMaxIpcPayloadBytes()};
* default {@link PipesMessage#MAX_PAYLOAD_BYTES}). The payload bytes were not
* consumed, so the stream is desynchronized and the connection must be closed.
* With a shared server the process keeps running (only this connection ends);
* with the default per-client forked server the process may still exit on the
* failed write, and the client reconnects on the next task.
*/(The same "server is healthy" wording is in the Heads up, CI will be red until |
… mapping - Correct PipesConfig.setMaxIpcPayloadBytes javadoc: limit applies to client-side reads of server responses, not both ends - Correct PayloadLimitExceededException javadoc: limit is the configured per-read value; server exit behaviour differs between shared and per-client modes - Add PAYLOAD_LIMIT_EXCEEDED to PipesParsingHelper.mapStatusToHttpResponse (INTERNAL_SERVER_ERROR arm) — exhaustive switch otherwise fails to compile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@tballison @THausherr can i please get another review on this PR? |
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!