Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-38669: Add workaround for Python threading bug #231

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions python/lsst/ctrl/mpexec/mpGraphExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import pickle
import signal
import sys
import threading
import time
from collections.abc import Iterable
from enum import Enum
Expand Down Expand Up @@ -141,6 +142,15 @@ def _executeJob(
snd_conn : `multiprocessing.Connection`
Connection to send job report to parent process.
"""
# This terrible hack is a workaround for Python threading bug:
# https://github.com/python/cpython/issues/102512. Should be removed
# when fix for that bug is deployed. Inspired by
# https://github.com/QubesOS/qubes-core-admin-client/pull/236/files.
thread = threading.current_thread()
if isinstance(thread, threading._DummyThread):
if getattr(thread, "_tstate_lock", "") is None:
thread._set_tstate_lock() # type: ignore[attr-defined]

if logConfigState and not CliLog.configState:
# means that we are in a new spawned Python process and we have to
# re-initialize logging
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ git+https://github.com/lsst/daf_butler@main#egg=lsst-daf-butler
git+https://github.com/lsst/utils@main#egg=lsst-utils
git+https://github.com/lsst/pipe_base@main#egg=lsst-pipe-base
git+https://github.com/lsst/pex_config@main#egg=lsst-pex-config
sqlalchemy <2.0
sqlalchemy