diff options
author | Filip Stefanak <filip.stefanak@gmail.com> | 2019-03-21 15:39:08 +0100 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-03-21 07:39:08 -0700 |
commit | ee4a53e9e5ae93231d6f7010f263b30a9924dabb (patch) | |
tree | b2db763ccf5cc2461b2805a2f24062131d27d278 | |
parent | 298326412e416ee56634e53fc32a7101b5324a30 (diff) | |
download | kafka-python-ee4a53e9e5ae93231d6f7010f263b30a9924dabb.tar.gz |
Fix race condition in protocol.send_bytes (#1752)
-rw-r--r-- | kafka/conn.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index e857d0a..28f9f3c 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -790,7 +790,8 @@ class BrokerConnection(object): if self.state not in (ConnectionStates.AUTHENTICATING, ConnectionStates.CONNECTED): return Errors.NodeNotReadyError(str(self)) - data = self._protocol.send_bytes() + with self._lock: + data = self._protocol.send_bytes() try: # In the future we might manage an internal write buffer # and send bytes asynchronously. For now, just block |