This is an automated email from the ASF dual-hosted git repository. tballison pushed a commit to branch TIKA-4809-stage-9 in repository https://gitbox.apache.org/repos/asf/tika.git
commit bb1a8492a795bc380dd9e0c597bee4af45cffbe3 Merge: 455fceadfc 787d9ffe4e Author: tallison <[email protected]> AuthorDate: Tue Aug 11 15:35:54 2026 -0400 Merge remote-tracking branch 'origin/main' into TIKA-4809-stage-9 .../ROOT/pages/advanced/setting-limits.adoc | 66 ++-- .../migration-to-4x/migrating-tika-server-4x.adoc | 8 +- docs/modules/ROOT/pages/pipes/timeouts.adoc | 404 ++++++++++++++++----- docs/modules/ROOT/pages/using-tika/cli/index.adoc | 10 +- .../ROOT/pages/using-tika/server/index.adoc | 14 + .../src/main/java/org/apache/tika/cli/TikaCLI.java | 35 +- .../test/java/org/apache/tika/cli/TikaCLITest.java | 31 ++ .../tika/cli/XmlToJsonConfigConverterTest.java | 2 +- .../xml-configs/tika-config-list-map-types.xml | 2 +- .../java/org/apache/tika/config/ParseTimeout.java | 233 ++++++++++++ .../apache/tika/config/TikaProgressTracker.java | 8 + .../java/org/apache/tika/config/TimeoutLimits.java | 69 ++-- .../apache/tika/detect/FileCommandDetector.java | 20 +- .../exception/EmbeddedLimitReachedException.java | 30 +- .../tika/exception/TikaTimeoutException.java | 71 +++- .../ParsingEmbeddedDocumentExtractor.java | 47 ++- .../apache/tika/metadata/TikaCoreProperties.java | 4 + .../org/apache/tika/parser/CompositeParser.java | 31 ++ .../java/org/apache/tika/parser/ParseRecord.java | 30 ++ .../tika/parser/external/ExternalParser.java | 9 +- .../tika/parser/external/ExternalParserConfig.java | 10 +- .../sax/AbstractRecursiveParserWrapperHandler.java | 6 - .../org/apache/tika/utils/FileProcessResult.java | 39 ++ .../java/org/apache/tika/utils/ProcessUtils.java | 158 +++++++- .../org/apache/tika/config/ParseTimeoutTest.java | 222 +++++++++++ .../tika/config/TikaProgressTrackerTest.java | 12 + .../tika/detect/FileCommandDetectorTest.java | 26 ++ ...arsingEmbeddedDocumentExtractorTimeoutTest.java | 276 ++++++++++++++ .../apache/tika/parser/CompositeParserTest.java | 59 +++ .../org/apache/tika/parser/mock/MockParser.java | 25 ++ .../org/apache/tika/utils/ProcessUtilsTest.java | 137 +++++++ .../apache/tika/detect/magika/MagikaDetector.java | 18 +- .../tika/detect/siegfried/SiegfriedDetector.java | 18 +- .../apache/tika/metadata/metadata-key-fields.json | 3 +- .../org/apache/tika/metadata/metadata-keys.json | 1 + .../java/org/apache/tika/http/TikaHttpClient.java | 182 +++++++++- .../org/apache/tika/http/TikaHttpClientTest.java | 171 +++++++++ .../org/apache/tika/http/TikaTestHttpServer.java | 38 +- .../org/apache/tika/parser/gdal/GDALParser.java | 18 +- .../tika/inference/AbstractEmbeddingFilter.java | 23 +- .../tika/inference/ImageEmbeddingConfig.java | 10 +- .../org/apache/tika/inference/InferenceConfig.java | 12 +- .../tika/inference/OpenAIEmbeddingFilter.java | 7 +- .../tika/inference/OpenAIImageEmbeddingParser.java | 19 +- .../tika/inference/JinaEmbeddingFilterTest.java | 2 +- .../tika/inference/OpenAIEmbeddingFilterTest.java | 2 +- .../inference/OpenAIImageEmbeddingParserTest.java | 2 +- .../tika/parser/ocr/tess4j/Tess4JConfig.java | 18 +- .../tika/parser/ocr/tess4j/Tess4JParser.java | 134 ++++++- .../tika/parser/ocr/tess4j/Tess4JConfigTest.java | 2 +- .../parser/ocr/tess4j/Tess4JOCRTimeoutTest.java | 123 +++++++ .../tika/parser/ocr/tess4j/Tess4JParserTest.java | 6 +- .../resources/config-examples/tess4j-full.json | 2 +- .../apache/tika/parser/vlm/AbstractVLMParser.java | 17 +- .../org/apache/tika/parser/vlm/VLMOCRConfig.java | 12 +- .../tika/parser/vlm/ClaudeVLMParserTest.java | 2 +- .../tika/parser/vlm/GeminiVLMParserTest.java | 2 +- .../tika/parser/vlm/OpenAIVLMParserTest.java | 4 +- .../resources/config-examples/claude-vlm-full.json | 2 +- .../resources/config-examples/gemini-vlm-full.json | 2 +- .../config-examples/openai-vlm-basic.json | 2 +- .../resources/config-examples/openai-vlm-full.json | 2 +- .../tika/parser/RecursiveParserWrapperTest.java | 7 +- .../config-examples/migration-full-example.json | 2 +- .../resources/config-examples/tesseract-basic.json | 2 +- .../resources/config-examples/tesseract-full.json | 2 +- .../apache/tika/parser/dwg/DWGParserConfig.java | 10 +- .../org/apache/tika/parser/dwg/DWGReadParser.java | 9 +- .../org/apache/tika/parser/dwg/DWGParserTest.java | 7 +- .../configs/tika-config-dwgRead-Timeout.json | 2 +- .../tika/parser/microsoft/libpst/LibPstParser.java | 7 +- .../microsoft/libpst/LibPstParserConfig.java | 10 +- .../apache/tika/parser/ocr/TesseractOCRConfig.java | 16 +- .../apache/tika/parser/ocr/TesseractOCRParser.java | 23 +- .../tika/parser/ocr/TesseractOCRConfigTest.java | 6 +- .../tika/parser/ocr/TesseractOCRParserTest.java | 2 +- .../resources/configs/TIKA-3582-tesseract.json | 2 +- .../configs/tika-config-tesseract-full.json | 2 +- .../configs/tika-config-tesseract-partial.json | 2 +- .../apache/tika/parser/pdf/AbstractPDF2XHTML.java | 30 ++ .../tika/renderer/pdf/poppler/PopplerRenderer.java | 18 +- .../org/apache/tika/parser/pdf/PDFParserTest.java | 95 +++++ .../org/apache/tika/parser/pkg/UnrarParser.java | 9 +- .../apache/tika/parser/strings/StringsConfig.java | 24 +- .../apache/tika/parser/strings/StringsParser.java | 16 +- .../tika/parser/strings/StringsConfigTest.java | 6 +- .../configs/tika-config-strings-full.json | 2 +- .../configs/tika-config-strings-partial.json | 2 +- .../apache/tika/async/cli/AsyncProcessorTest.java | 118 ++++++ .../org/apache/tika/pipes/api/PipesResult.java | 13 +- .../org/apache/tika/pipes/core/PipesClient.java | 78 ++-- .../apache/tika/pipes/core/async/AsyncEmitter.java | 7 + .../tika/pipes/core/async/AsyncProcessor.java | 11 +- .../tika/pipes/core/server/ConnectionHandler.java | 41 ++- .../apache/tika/pipes/core/server/EmitHandler.java | 40 ++ .../tika/pipes/core/server/ParseHandler.java | 8 +- .../apache/tika/pipes/core/server/PipesServer.java | 78 ++-- .../apache/tika/pipes/core/EmbeddedLimitsTest.java | 6 +- .../pipes/core/PartialTimeoutPassbackTest.java | 80 ++++ .../apache/tika/pipes/core/PipesClientTest.java | 167 +++++++++ .../pipes/pipesiterator/PipesIteratorBase.java | 14 +- .../tika/pipes/fetcher/http/HttpFetcher.java | 3 +- .../org/apache/tika/config/TimeoutLimitsTest.java | 30 +- .../sample-configs/vision/vlm-openai.json | 2 +- .../server/core/resource/MetadataResource.java | 19 +- .../server/core/resource/PipesParsingHelper.java | 2 +- .../tika/server/standard/MetadataResourceTest.java | 50 ++- 107 files changed, 3469 insertions(+), 561 deletions(-) diff --cc docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc index 9c00ba4531,bd71bf2e24..8ddce3d33e --- a/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc +++ b/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc @@@ -211,14 -172,13 +211,20 @@@ The `/tika` endpoint no longer routes b The following `TikaServerConfig` options have been removed: +* `returnStackTrace` - Removed as misleading. It gated only the error-response body, while + exception detail — including messages carrying file paths and document fragments — + continued to travel in `tk:exception:*` metadata on successful parses and inside + `/unpack` zips. Setting it to `false` did not keep stack traces inside the server, which + is what the name implied. Exception detail is now always returned; filter Tika's output + with a `MetadataFilter` before forwarding it somewhere less trusted. + - * `taskTimeoutMillis` - Now configured via `parse-context.timeout-limits.progressTimeoutMillis` (and optionally `totalTaskTimeoutMillis`); see xref:pipes/timeouts.adoc[Timeouts]. + * `taskTimeoutMillis` - Was the total time allowed per task before the forked process was + killed; that is now `parse-context.timeout-limits.totalTaskTimeoutMillis` (same + meaning, new home). 4.x also adds a second, independent axis with no pre-4.0 + equivalent -- `progressTimeoutMillis`, a stall detector that kills the task only after + a period of genuine silence, not merely after `totalTaskTimeoutMillis` of wall-clock + time -- worth setting deliberately rather than leaving at its default. See + xref:pipes/timeouts.adoc[Timeouts]. * `taskPulseMillis` - No longer needed * `minimumTimeoutMillis` - No longer needed diff --cc docs/modules/ROOT/pages/using-tika/server/index.adoc index 926488ea94,e66acc7258..e5b66dc038 --- a/docs/modules/ROOT/pages/using-tika/server/index.adoc +++ b/docs/modules/ROOT/pages/using-tika/server/index.adoc @@@ -285,25 -270,28 +285,39 @@@ any files already unpacked before the e gap, not yet addressed. |=== -By default (`returnStackTrace=false`), any exception text exposed this way is trimmed -to just the exception's class and message — not the full stack trace, which can -reveal internal file paths and library internals. For the `200 OK` family the -trimmed field is still always present when a failure occurred, so callers can detect -it either way; for the `422` family, the body carries no exception text at all unless -`returnStackTrace=true`. Set `returnStackTrace=true` to get the full trace — useful -in development, best left off in production. +[IMPORTANT] +==== +Exception detail is returned in full, and Tika does not redact it. + +Stack traces and their messages can contain the spooled file's path, the source +filename, and fragments of the document. That detail appears in `tk:exception:*` +metadata on **successful** parses as well as in error bodies — including inside the +`*.metadata.json` entries of an `/unpack` zip — so there is no single switch that keeps +it inside the server. + +A `returnStackTrace` setting previously suggested otherwise. It governed only the error +body, left the metadata untouched, and has been removed rather than left in place +implying a boundary it did not provide. + +If Tika's output is forwarded somewhere less trusted than the server itself, filter it +on the way out: configure a `MetadataFilter` to drop the fields you do not want, and +treat the whole response as potentially containing document-derived text. +==== + === Truncated results (`PARTIAL_TIMEOUT`) + + A third case is neither of the above: the worker is healthy, and no exception was + caught, but the document's total task timeout (`totalTaskTimeoutMillis`) ran out + partway through, so any not-yet-started embedded documents were skipped rather than + attempted. This gets its own `PipesResult.RESULT_STATUS`, `PARTIAL_TIMEOUT`, which maps + to `200 OK` on every endpoint (it is a success, just an incomplete one) alongside + `PARSE_SUCCESS`, `PARSE_SUCCESS_WITH_EXCEPTION`, etc. The response carries + `TikaCoreProperties.TASK_DEADLINE_REACHED = true` in its metadata and whatever content + was extracted before the deadline hit. See + xref:pipes/timeouts.adoc#_how_timeouts_are_reported[How Timeouts Are Reported] for the + full mental model, including the pipes-mode `throwOnDeadline` option that trades this + graceful truncation for a hard failure instead. + == Configuration Server behavior beyond host/port is controlled by a JSON config file passed via diff --cc tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/MetadataResourceTest.java index d099e9ea3a,75b2b36509..3106bd8d44 --- a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/MetadataResourceTest.java +++ b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/MetadataResourceTest.java @@@ -75,9 -83,10 +83,10 @@@ public class MetadataResourceTest exten protected void setUpProviders(JAXRSServerFactoryBean sf) { List<Object> providers = new ArrayList<>(); // Needed by getMetadataField's TikaServerParseException throw. - providers.add(new TikaServerParseExceptionMapper(false)); + providers.add(new TikaServerParseExceptionMapper()); providers.add(new JSONMessageBodyWriter()); providers.add(new CSVMessageBodyWriter()); + providers.add(new MetadataListMessageBodyWriter()); providers.add(new XMPMessageBodyWriter()); providers.add(new TextMessageBodyWriter()); sf.setProviders(providers);
