Skip to content

Commit ee4a53e

Browse files
isamarudpkp
authored andcommitted
Fix race condition in protocol.send_bytes (dpkp#1752)
1 parent 2983264 commit ee4a53e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kafka/conn.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,8 @@ def send_pending_requests(self):
790790
if self.state not in (ConnectionStates.AUTHENTICATING,
791791
ConnectionStates.CONNECTED):
792792
return Errors.NodeNotReadyError(str(self))
793-
data = self._protocol.send_bytes()
793+
with self._lock:
794+
data = self._protocol.send_bytes()
794795
try:
795796
# In the future we might manage an internal write buffer
796797
# and send bytes asynchronously. For now, just block

0 commit comments

Comments
 (0)