From 7836995b4fde6cb5ff8634675d3e24415fa93372 Mon Sep 17 00:00:00 2001 From: Chris Kleinknecht Date: Mon, 22 Jul 2019 18:07:27 -0700 Subject: [PATCH] Defensive copy for BoundedList deque iter --- opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 87bc1be8c12..4b9638ab909 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -59,7 +59,8 @@ def __len__(self): return len(self._dq) def __iter__(self): - return iter(self._dq) + with self._lock: + return iter(self._dq.copy()) def append(self, item): with self._lock: