Skip to content
Merged
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
14 changes: 10 additions & 4 deletions source/hwIo/ioThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from inspect import ismethod
from buildVersion import version_year
import NVDAState
from watchdog import getFormattedStacksForAllThreads

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is not used only for watchdog, would it be worth to move getFormattedStacksForAllThreads in a log-related file? E.g. logHandler.py

With watchdog.getFormattedStacksForAllThreads remaining but being deprecated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense, but then we could also extend the stack_info argument to take something to log all stacks. That might be something more suitable for a follow up.


LPOVERLAPPED_COMPLETION_ROUTINE = ctypes.WINFUNCTYPE(
None,
Expand Down Expand Up @@ -197,7 +198,12 @@ def fakeApc(param):
self.handle = None

def run(self):
while True:
ctypes.windll.kernel32.SleepEx(winKernel.INFINITE, True)
if self.exit:
break
try:
while True:
ctypes.windll.kernel32.SleepEx(winKernel.INFINITE, True)
if self.exit:
break
except Exception:
log.critical("Exception in IoThread function", exc_info=True)
stacks = getFormattedStacksForAllThreads()
log.info(f"Listing stacks for Python threads after IoThread crash:\n{stacks}")