Skip to content

Commit

Permalink
Try to log exceptions in IoThread (#14899)
Browse files Browse the repository at this point in the history
Summary of the issue:
I'm still seeing access violations in the IoThread here and there, same for @bramd. I really want to track these down! We need to handle those more gracefully anyway.

Description of user facing changes
Better logging

Description of development approach
De run block of the IOThread is now wrapped in a try/except that logs the stack. I hope the stack will give us more info about what's going wrong here.
  • Loading branch information
LeonarddeR committed May 4, 2023
1 parent 345154a commit d1ce3bc
Showing 1 changed file with 10 additions and 4 deletions.
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

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}")

0 comments on commit d1ce3bc

Please sign in to comment.