]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Do not fail mapserver startup if destroying existing process fails 06/3606/1
authorjsimomaa <jani.simomaa@gmail.com>
Sun, 24 Nov 2019 14:34:42 +0000 (16:34 +0200)
committerjsimomaa <jani.simomaa@gmail.com>
Sun, 24 Nov 2019 14:34:42 +0000 (16:34 +0200)
gitlab #71

Change-Id: I07084ee20b64c896afc1c0addc70d4c5355ed69c

org.simantics.maps.server/src/org/simantics/district/maps/server/TileserverMapnik.java

index 3ba5157da66407bc3f9020e20f8d3d4e9d643307..ef17ee06829db70a30a5c2ad45c94ab631345e68 100644 (file)
@@ -20,6 +20,7 @@ import org.simantics.district.maps.server.prefs.MapsServerPreferences;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
+import org.zeroturnaround.exec.InvalidExitValueException;
 import org.zeroturnaround.exec.ProcessExecutor;
 import org.zeroturnaround.exec.StartedProcess;
 import org.zeroturnaround.exec.stream.slf4j.Slf4jDebugOutputStream;
@@ -58,7 +59,13 @@ public class TileserverMapnik {
         if (Files.exists(getPid())) {
             String pid = new String(Files.readAllBytes(getPid()));
             PidProcess pr = Processes.newPidProcess(Integer.parseInt(pid));
-            pr.destroyForcefully();
+            try {
+                pr.destroyForcefully();
+            } catch (InvalidExitValueException e) {
+                // ignore, 
+            } catch (Exception e) {
+                LOGGER.error("Could not destroy process with pid {}", pid, e);
+            }
         }
         
         // check that npm dependencies are satisfied