Repository: ambari Updated Branches: refs/heads/branch-3.0-perf 9d6c7c81d -> d188fc3cd
AMBARI-21547. Race condition while calculating correlation_id (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d188fc3c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d188fc3c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d188fc3c Branch: refs/heads/branch-3.0-perf Commit: d188fc3cd9db8be23942289cd67f3cbafb1685d0 Parents: 9d6c7c8 Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Tue Jul 25 17:26:37 2017 +0300 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Tue Jul 25 17:26:37 2017 +0300 ---------------------------------------------------------------------- ambari-agent/src/main/python/ambari_agent/security.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d188fc3c/ambari-agent/src/main/python/ambari_agent/security.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/security.py b/ambari-agent/src/main/python/ambari_agent/security.py index 230af62..9509619 100644 --- a/ambari-agent/src/main/python/ambari_agent/security.py +++ b/ambari-agent/src/main/python/ambari_agent/security.py @@ -114,13 +114,14 @@ class AmbariStompConnection(WsConnection): def send(self, destination, message, content_type=None, headers=None, **keyword_headers): with self.lock: self.correlation_id += 1 + correlation_id = self.correlation_id - logger.info("Event to server at {0} (correlation_id={1}): {2}".format(destination, self.correlation_id, message)) + logger.info("Event to server at {0} (correlation_id={1}): {2}".format(destination, correlation_id, message)) body = json.dumps(message) - WsConnection.send(self, destination, body, content_type=content_type, headers=headers, correlationId=self.correlation_id, **keyword_headers) + WsConnection.send(self, destination, body, content_type=content_type, headers=headers, correlationId=correlation_id, **keyword_headers) - return self.correlation_id + return correlation_id def add_listener(self, listener): self.set_listener(listener.__class__.__name__, listener)