You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2021/06/21 16:23:51 UTC
[ignite] branch master updated: IGNITE-14831 [Test failed]
GridCommandLineLoaderTest test crashes the process on some environments
(#9157)
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 102c64f IGNITE-14831 [Test failed] GridCommandLineLoaderTest test crashes the process on some environments (#9157)
102c64f is described below
commit 102c64f399af87567a6b50f1aad08dece70691d6
Author: luchnikovbsk <43...@users.noreply.github.com>
AuthorDate: Mon Jun 21 19:23:32 2021 +0300
IGNITE-14831 [Test failed] GridCommandLineLoaderTest test crashes the process on some environments (#9157)
---
.../ignite/internal/util/GridJavaProcess.java | 23 +++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
index a770b51..7beb865 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java
@@ -52,6 +52,9 @@ public final class GridJavaProcess {
/** Internal protocol message prefix saying that the next text in the outputted line is pid. */
public static final String PID_MSG_PREFIX = "my_pid_is:";
+ /** Default pid. */
+ private static final String DFLT_PID = "-1";
+
/** Logger */
private IgniteLogger log;
@@ -59,7 +62,7 @@ public final class GridJavaProcess {
private Process proc;
/** Pid of wrapped process. Made as array to be changeable in nested static class. */
- private volatile String pid = "-1";
+ private volatile String pid = DFLT_PID;
/** system.out stream grabber for process in which user class is running. */
private ProcessStreamGrabber osGrabber;
@@ -186,17 +189,19 @@ public final class GridJavaProcess {
* @throws Exception If any problem occurred.
*/
public void kill() throws Exception {
- Process killProc = U.isWindows() ?
- Runtime.getRuntime().exec(new String[] {"taskkill", "/pid", pid, "/f", "/t"}) :
- Runtime.getRuntime().exec(new String[] {"kill", "-9", pid});
+ if (!pid.equals(DFLT_PID)) {
+ Process killProc = U.isWindows() ?
+ Runtime.getRuntime().exec(new String[]{"taskkill", "/pid", pid, "/f", "/t"}) :
+ Runtime.getRuntime().exec(new String[]{"kill", "-9", pid});
- if (!killProc.waitFor(5000, TimeUnit.MILLISECONDS))
- throw new IllegalStateException("The kill process is hanging.");
+ if (!killProc.waitFor(5000, TimeUnit.MILLISECONDS))
+ throw new IllegalStateException("The kill process is hanging.");
- int exitVal = killProc.exitValue();
+ int exitVal = killProc.exitValue();
- if (exitVal != 0 && log.isInfoEnabled())
- log.info(String.format("Abnormal exit value of %s for trying to kill the pid %s", exitVal, pid));
+ if (exitVal != 0 && log.isInfoEnabled())
+ log.info(String.format("Abnormal exit value of %s for trying to kill the pid %s", exitVal, pid));
+ }
if (!proc.waitFor(5000, TimeUnit.MILLISECONDS))
throw new IllegalStateException("Failed to kill grid java process.");