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 ca6f366ce TIKA-4014 -- wait 30 seconds for OS to release port, improve 
logging and fix > to >=
ca6f366ce is described below

commit ca6f366ce8e08023b19625269eb2961bb3ffc991
Author: tallison <talli...@apache.org>
AuthorDate: Wed Apr 12 12:54:39 2023 -0400

    TIKA-4014 -- wait 30 seconds for OS to release port, improve logging and 
fix > to >=
---
 .../main/java/org/apache/tika/server/core/TikaServerWatchDog.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerWatchDog.java
 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerWatchDog.java
index fa8dae289..9ca7c2218 100644
--- 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerWatchDog.java
+++ 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerWatchDog.java
@@ -215,10 +215,11 @@ public class TikaServerWatchDog implements 
Callable<WatchDogResult> {
     }
 
     private synchronized ForkedProcess startForkedProcess(int restarts) throws 
Exception {
+        LOG.debug("attempting to start forked process on {} restarts", 
restarts);
         int consecutiveRestarts = 0;
-        //if there's a bind exception, retry for 5 seconds to give the OS
+        //if there's a bind exception, retry for 30 seconds to give the OS
         //a chance to release the port
-        int maxBind = 5;
+        int maxBind = 30;
         while (consecutiveRestarts < maxBind && ! shutDown) {
             try {
                 ForkedProcess forkedProcess = new ForkedProcess(restarts);
@@ -229,7 +230,7 @@ public class TikaServerWatchDog implements 
Callable<WatchDogResult> {
                         "Will retry {} times.", consecutiveRestarts, maxBind);
                 consecutiveRestarts++;
                 Thread.sleep(1000);
-                if (consecutiveRestarts > maxBind) {
+                if (consecutiveRestarts >= maxBind) {
                     throw e;
                 }
             }

Reply via email to