You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2022/11/15 20:05:13 UTC
[tika] branch main updated: Improve logging and warnings about failures to start pipes clients
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 3286e15b3 Improve logging and warnings about failures to start pipes clients
new 9d494b270 Merge remote-tracking branch 'origin/main'
3286e15b3 is described below
commit 3286e15b3fe6755ee9cd6bbd7e41fb21487be1af
Author: tballison <ta...@apache.org>
AuthorDate: Tue Nov 15 15:04:54 2022 -0500
Improve logging and warnings about failures to start pipes clients
---
.../tika/pipes/FailedToStartClientException.java | 27 ++++++++++++++++++++++
.../java/org/apache/tika/pipes/PipesClient.java | 9 +++++++-
.../apache/tika/pipes/async/AsyncProcessor.java | 1 +
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/tika-core/src/main/java/org/apache/tika/pipes/FailedToStartClientException.java b/tika-core/src/main/java/org/apache/tika/pipes/FailedToStartClientException.java
new file mode 100644
index 000000000..fd49927e1
--- /dev/null
+++ b/tika-core/src/main/java/org/apache/tika/pipes/FailedToStartClientException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.pipes;
+
+/**
+ * This should be catastrophic
+ */
+public class FailedToStartClientException extends RuntimeException {
+
+ public FailedToStartClientException(Throwable t) {
+ super(t);
+ }
+}
diff --git a/tika-core/src/main/java/org/apache/tika/pipes/PipesClient.java b/tika-core/src/main/java/org/apache/tika/pipes/PipesClient.java
index 97b86a741..cb4f3ffd9 100644
--- a/tika-core/src/main/java/org/apache/tika/pipes/PipesClient.java
+++ b/tika-core/src/main/java/org/apache/tika/pipes/PipesClient.java
@@ -356,6 +356,7 @@ public class PipesClient implements Closeable {
private void restart() throws IOException, InterruptedException, TimeoutException {
if (process != null) {
+ LOG.debug("process still alive; trying to destroy it");
destroyForcibly();
boolean processEnded = process.waitFor(30, TimeUnit.SECONDS);
if (! processEnded) {
@@ -379,8 +380,14 @@ public class PipesClient implements Closeable {
}
ProcessBuilder pb = new ProcessBuilder(getCommandline());
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
- process = pb.start();
+ try {
+ process = pb.start();
+ } catch (Exception e) {
+ //Do we ever want this to be not fatal?!
+ LOG.error("failed to start client", e);
+ throw new FailedToStartClientException(e);
+ }
input = new DataInputStream(process.getInputStream());
output = new DataOutputStream(process.getOutputStream());
diff --git a/tika-core/src/main/java/org/apache/tika/pipes/async/AsyncProcessor.java b/tika-core/src/main/java/org/apache/tika/pipes/async/AsyncProcessor.java
index fee2ba37e..e86aa71b3 100644
--- a/tika-core/src/main/java/org/apache/tika/pipes/async/AsyncProcessor.java
+++ b/tika-core/src/main/java/org/apache/tika/pipes/async/AsyncProcessor.java
@@ -289,6 +289,7 @@ public class AsyncProcessor implements Closeable {
try {
result = pipesClient.process(t);
} catch (IOException e) {
+ LOG.warn("pipesClient crash", e);
result = PipesResult.UNSPECIFIED_CRASH;
}
if (LOG.isTraceEnabled()) {