From ae4a2db1e782ba765a86e58a3df2269203d24f31 Mon Sep 17 00:00:00 2001 From: Egor Eliseev Date: Tue, 1 Jul 2025 17:44:45 +0000 Subject: [PATCH] PY-82266 Debugging is stopped only after second pressing Stop button Merge-request: IJ-MR-167496 Merged-by: Egor Eliseev GitOrigin-RevId: 010536e426b82b7c56ae117c4410a58fa3cdfe76 --- python/helpers/pydev/_pydevd_bundle/pydevd_comm.py | 5 +++-- .../pydev/_pydevd_bundle/pydevd_daemon_thread.py | 1 - python/helpers/pydev/pydevd.py | 12 ------------ 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py index f8c67858e2ee..81dd48a75ab2 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py @@ -522,8 +522,9 @@ class NetCommand: sock.sendall(('Content-Length: %s\r\n\r\n' % len(as_bytes)).encode('ascii')) try: sock.sendall(as_bytes) - except BrokenPipeError: - print("Connection closed unexpectedly!") + except OSError as e: + if not IS_PY2 and isinstance(e, ConnectionError): + print("Connection error: %s" % (e,)) @classmethod def _show_debug_info(cls, cmd_id, seq, text): diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_daemon_thread.py b/python/helpers/pydev/_pydevd_bundle/pydevd_daemon_thread.py index d51c556ebcb8..b761cd1c2483 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_daemon_thread.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_daemon_thread.py @@ -13,7 +13,6 @@ if USE_LOW_IMPACT_MONITORING: class PyDBDaemonThread(threading.Thread): - def __init__(self, py_db=None, target_and_args=None): """ :param target_and_args: diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index 1e3b2477c69b..6aecad97422a 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -1447,18 +1447,6 @@ class PyDB(object): return pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads (first call)") - - # Wait until a time when there are no commands being processed to kill the threads. - started_at = time.time() - while time.time() < started_at + timeout: - with self._main_lock: - writer = self.writer - if writer is None or writer.empty(): - pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads no commands being processed.") - break - else: - pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads timed out waiting for writer to be empty.") - pydb_daemon_threads = set(self.created_pydb_daemon_threads) for t in pydb_daemon_threads: if hasattr(t, "do_kill_pydev_thread"):