[
https://issues.apache.org/jira/browse/TIKA-4839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18108882#comment-18108882
]
ASF GitHub Bot commented on TIKA-4839:
--------------------------------------
Copilot commented on code in PR #3081:
URL: https://github.com/apache/tika/pull/3081#discussion_r3873288079
##########
tika-pipes/tika-pipes-core/src/test/java/org/apache/tika/pipes/core/SentinelServerManager.java:
##########
@@ -68,6 +74,21 @@ public Path getTempDirectory() {
return null;
}
+ @Override
+ public long getGeneration() {
+ return 0;
+ }
+
+ @Override
+ public void markServerForRestart(RestartReason reason, long generation) {
+ marked = reason;
+ }
+
+ @Override
+ public int handleCrashAndGetExitCode(long generation) {
+ return -1;
+ }
+
@Override
public void close() {
Review Comment:
`SentinelServerManager` introduces a `closed` flag and documents that
`ensureRunning()` should throw after close, but `close()` does not set `closed
= true`. This makes the helper behave differently depending on whether tests
set the flag directly vs. calling `close()`. Consider setting `closed = true`
inside `close()` (and keeping it idempotent) so the sentinel consistently
simulates a real closed manager.
##########
tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/PerClientServerManager.java:
##########
@@ -291,18 +292,31 @@ public boolean needsRestart() {
return pendingRestart;
}
+ /**
+ * One client owns one manager here, so {@code generation} carries no
information a sibling
+ * could invalidate and is accepted only to satisfy the single {@link
ServerManager} spelling.
+ * Shared mode is where staleness is real.
+ */
@Override
- public void markServerForRestart() {
- markServerForRestart(RestartReason.CRASH);
+ public void markServerForRestart(RestartReason reason, long generation) {
Review Comment:
The parameter name `generation` here shadows the class field `generation`
and is intentionally unused in per-client mode. To avoid confusion, rename the
parameter to something like `ignoredGeneration` (or similar) to make it
explicit that it is not consulted.
##########
tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/PipesClient.java:
##########
@@ -235,6 +235,16 @@ public PipesResult process(FetchEmitTuple t) throws
IOException, InterruptedExce
closeConnection();
return buildFatalResult(t.getId(), t.getEmitKey(),
PipesResult.RESULT_STATUS.FAILED_TO_INITIALIZE,
intermediateResult.get());
+ } catch (IllegalStateException e) {
+ // The manager was closed underneath us: a request thread racing
PipesParser.close()
+ // or AsyncProcessor.close(), which interrupts workers without
awaiting them. Nothing
+ // to restart and nothing to recover
> Add Micrometer/Prometheus metrics to tika-server
> ------------------------------------------------
>
> Key: TIKA-4839
> URL: https://issues.apache.org/jira/browse/TIKA-4839
> Project: Tika
> Issue Type: Task
> Reporter: Tim Allison
> Priority: Major
>
> Now that we have a reliable back-pressure signal in tika-server, let's add a
> Micrometer registry with a Prometheus scrape endpoint on a separate port so
> that we can publish stats for potential auto-scaling triggers.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)