windows storm kill topology 时 storm supervisor 错误退出

windows storm supervisor error quit when storm kill topology

风暴版本:1.2.2 平台:Windows Server 2008

我已经在一台 linux 服务器和一台 Windows 服务器上安装了风暴集群。这两台服务器都部署了nimbus和supervisor服务。 我启动了一个拓扑,然后将其终止。我发现 Windows 服务器上的主管进程错误退出,Windows 服务器上的工作进程仍然存在。

表明:

"error: cannot kill pid xxx process, can only terminate this process(use \F option)."

错误信息翻译自下图: error-info-pic

我不知道这个错误,我已经使用 google 搜索了一些答案,但没有找到,所以我将此消息发送给您。我希望你能帮助我。

更新于 2018/12/24

我发现worker会启动一个topology进程,先kill topology error,然后在kill supervisor时kill worker error。

我编译了一个新的storm-core.jar,并在supervisor kill worker时添加了一些详细日志,错误详细日志如下:

org.apache.storm.shade.org.apache.commons.exec.ExecuteException: Process exited with an error: 128 (Exit value: 128) at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377) ~[storm-core-1.2.2.jar:1.2.2] at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160) ~[storm-core-1.2.2.jar:1.2.2] at org.apache.storm.shade.org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147) ~[storm-core-1.2.2.jar:1.2.2] at org.apache.storm.utils.Utils.execCommand(Utils.java:1914) ~[storm-core-1.2.2.jar:1.2.2] at org.apache.storm.utils.Utils.sendSignalToProcess(Utils.java:1943) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.utils.Utils.killProcessWithSigTerm(Utils.java:1962) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Container.kill(Container.java:166) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Container.kill(Container.java:184) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Slot.killContainerForChangedAssignment(Slot.java:311) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Slot.handleRunning(Slot.java:527) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Slot.stateMachineStep(Slot.java:265) [storm-core-1.2.2.jar:1.2.2] at org.apache.storm.daemon.supervisor.Slot.run(Slot.java:752) [storm-core-1.2.2.jar:1.2.2]

这有点像在黑暗中开枪,但您是否运行以管理员身份管理 Storm 进程? Storm 需要 运行 作为 Windows 的管理员,或者您需要设置用户 运行ning Storm 以允许创建符号链接。

在 Windows https://storm.apache.org/releases/2.0.0-SNAPSHOT/windows-users-guide.html 上有一些关于 运行ning Storm 的内容。

我编译了一个新的风暴-core.jar,在"org.apache.storm.utils.Utils::sendSignalToProcess"函数中,我添加了一些log msg,如下:

public static void sendSignalToProcess(long lpid, int signum) throws IOException {
    String pid = Long.toString(lpid);
    try {
        // add this log
        LOG.info("Added: {}.", signum);
        if (isOnWindows()) {
            // change this condition
            if (signum == SIGKILL || signum == SIGTERM) {
                // change this code
                execCommand("taskkill", "/F", "/T", "/pid", pid);
            } else {
                execCommand("taskkill", "/pid", pid);
            }
        } else {
            execCommand("kill", "-" + signum, pid);
        }
    } catch (ExecuteException e) {
        LOG.info("Error when trying to kill {}. Process is probably already dead.", pid);
    } catch (IOException e) {
        LOG.info("IOException Error when trying to kill {}.", pid);
        throw e;
    }
}

我发现supervisor在storm kill topology时发送signal 15(term)给worker,但是supervisor在使用signal 15时不能kill worker,它必须使用signal 9(kill)强制kill。所以我决定在Windows台服务器上使用新编译的storm-code.jar。

我仍然不知道为什么主管不能使用信号15杀死工人而只使用信号9(即:taskkill使用/F选项可以杀死工人),但这应该是一个windows问题, 所以我关闭这个问题。