kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: MINOR: Make JmxMixin wait for the monitored process to be listening on the JMX port before launching JmxTool
Date Tue, 27 Jun 2017 00:11:08 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.1 9db8475f7 -> 3fcb7808c


MINOR: Make JmxMixin wait for the monitored process to be listening on the JMX port before
launching JmxTool

Author: Ewen Cheslack-Postava <me@ewencp.org>

Reviewers: Apurva Mehta <apurva@confluent.io>, Ismael Juma <ismael@juma.me.uk>

Closes #3437 from ewencp/wait-jmx-listening

(cherry picked from commit e45c767d5344c4d0a42c444840ad81a82fcc9f7f)
Signed-off-by: Ewen Cheslack-Postava <me@ewencp.org>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/3fcb7808
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/3fcb7808
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/3fcb7808

Branch: refs/heads/0.10.1
Commit: 3fcb7808cafffe5596b9c9c8f7c101f12ce2b5c5
Parents: 9db8475
Author: Ewen Cheslack-Postava <me@ewencp.org>
Authored: Mon Jun 26 17:06:38 2017 -0700
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Mon Jun 26 17:10:55 2017 -0700

----------------------------------------------------------------------
 tests/kafkatest/services/monitor/jmx.py | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3fcb7808/tests/kafkatest/services/monitor/jmx.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/monitor/jmx.py b/tests/kafkatest/services/monitor/jmx.py
index 19ca5fd..bad1ec9 100644
--- a/tests/kafkatest/services/monitor/jmx.py
+++ b/tests/kafkatest/services/monitor/jmx.py
@@ -39,6 +39,15 @@ class JmxMixin(object):
         if self.started[idx-1] or self.jmx_object_names is None:
             return
 
+        # JmxTool is not particularly robust to slow-starting processes. In order to ensure
JmxTool doesn't fail if the
+        # process we're trying to monitor takes awhile before listening on the JMX port,
wait until we can see that port
+        # listening before even launching JmxTool
+        def check_jmx_port_listening():
+            return 0 == node.account.ssh("nc -z 127.0.0.1 %d" % self.jmx_port, allow_fail=True)
+
+        wait_until(check_jmx_port_listening, timeout_sec=30, backoff_sec=.1,
+                   err_msg="%s: Never saw JMX port for %s start listening" % (node.account,
self))
+
         cmd = "%s kafka.tools.JmxTool " % self.path.script("kafka-run-class.sh", node)
         cmd += "--reporting-interval 1000 --jmx-url service:jmx:rmi:///jndi/rmi://127.0.0.1:%d/jmxrmi"
% self.jmx_port
         for jmx_object_name in self.jmx_object_names:


Mime
View raw message