Skip to content

Commit f074335

Browse files
authored
Fix race condition where pending Ack IDs can be modified by another thread. (#5929)
1 parent 001e897 commit f074335

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ def _get_initial_request(self):
379379
# Any ack IDs that are under lease management need to have their
380380
# deadline extended immediately.
381381
if self._leaser is not None:
382-
lease_ids = self._leaser.ack_ids
382+
# Explicitly copy the list, as it could be modified by another
383+
# thread.
384+
lease_ids = list(self._leaser.ack_ids)
383385
else:
384386
lease_ids = []
385387

0 commit comments

Comments
 (0)