You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2018/02/21 18:52:59 UTC

[kafka] branch trunk updated: MINOR: Cancel port forwarding for HttpMetricsCollector during cleanup

This is an automated email from the ASF dual-hosted git repository.

ewencp pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new da379c9  MINOR: Cancel port forwarding for HttpMetricsCollector during cleanup
da379c9 is described below

commit da379c95e4e3fe4dbe4d810a27a2d0b821cb2fb1
Author: Ewen Cheslack-Postava <me...@ewencp.org>
AuthorDate: Wed Feb 21 10:52:27 2018 -0800

    MINOR: Cancel port forwarding for HttpMetricsCollector during cleanup
    
    Currently port forwarding is setup for HttpMetricsCollector when the Service's start_node method is called, but not canceled during stop. This hasn't presented a problem so far because we don't have tests that use this *and* restart the service. However, if a test/service does that, it will throw an exception since the port is already bound.
    
    This just does the cleanup when stopping so a subsequent attempt to start again will succeed.
    
    https://jenkins.confluent.io/job/system-test-kafka-branch-builder/1320 is a test run for a Test that uses ProducerPerformanceService, which in turn uses HttpMetricsCollector to validate the change.
    
    Author: Ewen Cheslack-Postava <me...@ewencp.org>
    
    Reviewers: Ismael Juma <is...@juma.me.uk>, Apurva Mehta <ap...@confluent.io>
    
    Closes #4604 from ewencp/cleanup-reverse-port-forward
---
 tests/kafkatest/services/monitor/http.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kafkatest/services/monitor/http.py b/tests/kafkatest/services/monitor/http.py
index 83324df..88ddb2e 100644
--- a/tests/kafkatest/services/monitor/http.py
+++ b/tests/kafkatest/services/monitor/http.py
@@ -173,6 +173,7 @@ class _ReverseForwarder(object):
         self.logger = logger
         self._node = node
         self._local_port = local_port
+        self._remote_port = remote_port
 
         self.logger.debug('Forwarding %s port %d to driver port %d', node, remote_port, local_port)
 
@@ -189,6 +190,7 @@ class _ReverseForwarder(object):
         self._accept_thread.join(30)
         if self._accept_thread.isAlive():
             raise RuntimeError("Failed to stop reverse forwarder on %s", self._node)
+        self._transport.cancel_port_forward('', self._remote_port)
 
     def _accept(self):
         while not self._stopping:

-- 
To stop receiving notification emails like this one, please contact
ewencp@apache.org.