Skip to content

Commit cf9c2c8

Browse files
authored
TIKA-4813 - pre-4.0.0 cleanup: clock-agnostic ParseTimeout, nanoTime inte… (#3011)
1 parent 84dd882 commit cf9c2c8

58 files changed

Lines changed: 982 additions & 692 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/modules/ROOT/pages/advanced/integration-testing/tika-eval-regression.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ Flags:
169169
* `-n` / `--numClients` — forked worker processes (default 4)
170170
* `-p` / `--pluginsDir` — explicit plugins directory (omit when
171171
running from the unzipped distribution — auto-discovery handles it)
172-
* `-T` / `--timeoutMs` — per-parse timeout
172+
* `-T` / `--timeoutMillis` — total task timeout per file (sets
173+
`totalTaskTimeoutMillis`)
173174

174175
Each run forks worker processes and produces one `.json` per input
175176
file under the output directory. Run them sequentially or in

docs/modules/ROOT/pages/advanced/local-vlm-server.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ Point the `OpenAIVLMParser` at your local server:
335335
"openai-vlm-parser": {
336336
"baseUrl": "http://127.0.0.1:8000",
337337
"model": "jinaai/jina-vlm",
338-
"timeoutSeconds": 600
338+
"timeoutMillis": 600000
339339
}
340340
}
341341
]
342342
}
343343
----
344344

345-
A generous `timeoutSeconds` is recommended — local inference on Apple
345+
A generous `timeoutMillis` is recommended — local inference on Apple
346346
Silicon takes 10-60 seconds per page depending on model size and image
347347
resolution.
348348

@@ -434,7 +434,7 @@ Safe to ignore.
434434
* Jina VLM (2.4B) on M3 Max: ~15-30 seconds per page image
435435
* Model loading at startup: ~20-30 seconds
436436
* Keeping the server running avoids reloading the model per request
437-
* Consider `timeoutSeconds: 600` or higher in the Tika config for large
437+
* Consider `timeoutMillis: 600000` or higher in the Tika config for large
438438
or complex images
439439

440440
== Licensing

docs/modules/ROOT/pages/advanced/setting-limits.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ budget, no matter how it is itself configured.
262262

263263
|`progressTimeoutMillis`
264264
|120000 (2 minutes)
265-
|Maximum time in milliseconds the task may go silent before it is considered hung and
266-
killed. Catches infinite loops and hung processes.
265+
|Maximum time in milliseconds the task may go silent before it is considered hung.
266+
Catches infinite loops and hung processes. Enforced (the task actually killed) only
267+
when the parse runs in a forked JVM -- Pipes mode or tika-app `--fork`; in plain
268+
in-process library use nothing kills the parsing thread.
267269

268270
|`throwOnDeadline`
269271
|false

docs/modules/ROOT/pages/configuration/parsers/external-parser.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ configured, the raw bytes are written as text.
9797
|`boolean`
9898
|Store raw stderr in metadata. Default: `true`.
9999

100-
|`timeoutMs`
100+
|`timeoutMillis`
101101
|`long`
102102
|Process timeout in milliseconds. Default: `60000`.
103103

docs/modules/ROOT/pages/configuration/parsers/tess4j-parser.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ libraries. Prepended to `jna.library.path` at initialization time.
181181
threads that will call the parser concurrently. Each instance consumes
182182
native memory.
183183

184-
|`timeoutSeconds`
185-
|`120`
186-
|Maximum time (seconds) to wait for a pooled `Tesseract` instance before
187-
throwing an exception.
184+
|`timeoutMillis`
185+
|`120000`
186+
|Timeout (milliseconds) applied both to waiting for a pooled `Tesseract`
187+
instance and to each image's OCR call. Each is budgeted separately up to this
188+
value, clipped to whatever remains of the task's total budget.
188189

189190
|`dpi`
190191
|`300`

docs/modules/ROOT/pages/configuration/parsers/vlm-parsers.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ All three parsers share the same configuration POJO (`VLMOCRConfig`):
183183
|`4096`
184184
|Maximum tokens the model may generate.
185185

186-
|`timeoutSeconds`
187-
|`300`
188-
|HTTP read timeout in seconds.
186+
|`timeoutMillis`
187+
|`120000`
188+
|HTTP read timeout in milliseconds.
189189

190190
|`apiKey`
191191
|`""` (empty)

docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ The following `TikaServerConfig` options have been removed:
174174
175175
* `taskTimeoutMillis` - Was the total time allowed per task before the forked process was
176176
killed; that is now `parse-context.timeout-limits.totalTaskTimeoutMillis` (same
177-
meaning, new home). 4.x also adds a second, independent axis with no pre-4.0
177+
meaning, new home). **The default changed**: 3.x `taskTimeoutMillis` defaulted to
178+
`300000` (5 minutes), while `totalTaskTimeoutMillis` defaults to `3600000` (1 hour) --
179+
an upgrader who never set the 3.x value gets a much larger worst-case per-document
180+
bound. Set `totalTaskTimeoutMillis: 300000` to keep the 3.x behavior. 4.x also adds a
181+
second, independent axis with no pre-4.0
178182
equivalent -- `progressTimeoutMillis`, a stall detector that kills the task only after
179183
a period of genuine silence, not merely after `totalTaskTimeoutMillis` of wall-clock
180184
time -- worth setting deliberately rather than leaving at its default. See

docs/modules/ROOT/pages/migration-to-4x/migrating-to-4x.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ External parsers must now be explicitly configured via JSON. See
241241
xref:configuration/parsers/external-parser.adoc[External Parser Configuration]
242242
for details.
243243

244+
== Timeout Model Changes
245+
246+
4.x replaces the previous ad hoc, per-parser timeout handling with a single unified model
247+
(`TimeoutLimits` / `ParseTimeout`) shared across library use, `tika-app --fork`, and Tika
248+
Pipes. This affects error handling (`TikaTimeoutException` is now a checked exception),
249+
CLI flags (`tika-app --fork-timeout` was removed), and several parser/pipes config field
250+
names (`*TimeoutSeconds`/`*TimeoutMs` -> `*TimeoutMillis`, including a unit change for
251+
Tess4J specifically). See
252+
xref:pipes/timeouts.adoc#_upgrading_from_tika_3_x[Timeouts: Upgrading from Tika 3.x] for
253+
the full list of behavioral changes and required config edits.
254+
244255
== Deprecations and Removals
245256

246257
* `TikaConfig` -- replaced by `TikaLoader`

docs/modules/ROOT/pages/pipes/configuration.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ how many forked JVMs to run, timeouts, memory management, and parse behavior.
2525
{
2626
"pipes": {
2727
"numClients": 4,
28-
"socketTimeoutMs": 60000,
28+
"socketTimeoutMillis": 60000,
2929
"maxFilesProcessedPerProcess": 10000,
3030
"parseMode": "RMETA",
3131
"onParseException": "EMIT",
@@ -69,13 +69,17 @@ See also xref:pipes/timeouts.adoc[Timeouts] for the full timeout model.
6969
|===
7070
|Field |Default |Description
7171

72-
|`socketTimeoutMs`
72+
|`socketTimeoutMillis`
7373
|`60000`
7474
|Maximum time (ms) to wait for data from a forked process. If no heartbeat or result is received within this window, the parse is considered hung.
7575

76-
|`heartbeatIntervalMs`
76+
|`heartbeatIntervalMillis`
7777
|`1000`
78-
|Interval (ms) between heartbeats sent from the forked process. Must be significantly less than `socketTimeoutMs`.
78+
|Interval (ms) between heartbeats sent from the forked process. Must be significantly less than `socketTimeoutMillis`.
79+
80+
|`maxTotalTaskTimeoutMillis`
81+
|`3600000`
82+
|Ceiling for *request-supplied* timeout limits: a per-request `timeout-limits` override may lower its timeouts freely but can never raise `totalTaskTimeoutMillis` or `progressTimeoutMillis` above this value (values over the cap are clamped with a warning). Limits set in the server's own `parse-context` are trusted and not subject to this cap.
7983

8084
|`shutdownClientAfterMillis`
8185
|`300000`

docs/modules/ROOT/pages/pipes/getting-started.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ The `pipes` section controls the pipeline behavior:
113113
|`RMETA`
114114
|Output mode: `RMETA` (full recursive metadata), `CONCATENATE`, `CONTENT_ONLY`, `UNPACK`
115115

116-
|`socketTimeoutMs`
116+
|`socketTimeoutMillis`
117117
|`60000`
118-
|Maximum time (ms) for a single parse operation
118+
|Maximum time (ms) to wait for data (heartbeat or result) from a forked process
119+
before it is considered hung -- a transport/liveness bound, not a per-parse limit
119120

120121
|`maxFilesProcessedPerProcess`
121122
|`10000`

0 commit comments

Comments
 (0)