You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by go...@apache.org on 2020/02/07 21:30:25 UTC
[beam] branch master updated: Fix race exception in python worker
status thread dump
This is an automated email from the ASF dual-hosted git repository.
goenka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 294b2e6 Fix race exception in python worker status thread dump
new 78ab631 Merge pull request #10797 from y1chi/py_thread_dump
294b2e6 is described below
commit 294b2e60c3bb0743accd33fa164539638f7efcc0
Author: Yichi Zhang <zy...@google.com>
AuthorDate: Thu Feb 6 17:07:35 2020 -0800
Fix race exception in python worker status thread dump
---
sdks/python/apache_beam/runners/worker/worker_status.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sdks/python/apache_beam/runners/worker/worker_status.py b/sdks/python/apache_beam/runners/worker/worker_status.py
index 494f953..8c5ce76 100644
--- a/sdks/python/apache_beam/runners/worker/worker_status.py
+++ b/sdks/python/apache_beam/runners/worker/worker_status.py
@@ -41,7 +41,12 @@ def thread_dump():
frames = sys._current_frames() # pylint: disable=protected-access
for t in threading.enumerate():
- stack_trace = ''.join(traceback.format_stack(frames[t.ident]))
+ try:
+ stack_trace = ''.join(traceback.format_stack(frames[t.ident]))
+ except KeyError:
+ # the thread may have been destroyed already while enumerating, in such
+ # case, skip to next thread.
+ continue
thread_ident_name = (t.ident, t.name)
stack_traces[stack_trace].append(thread_ident_name)