Skip to content

Issue when logging error or printing to stderr in another thread #16070

@CyrilleB79

Description

@CyrilleB79

Opened in replacement of #16065 for clarity.

Steps to reproduce:

Execute the following instructions in the console:

>>> import threading
>>> import core
>>> def f():
...  return 0/0  # raises an error
... 
>>> core.callLater(1000, lambda: threading.Thread(None, f).start())
<wx.core.CallLater object at 0x05166470>

Actual behavior:

The following messages are logged

ERROR - stderr (14:08:47.089) - Thread-71 (f) (15936):
Exception in thread
ERROR - stderr (14:08:47.117) - Thread-71 (f) (15936):
Thread-71 (f)
ERROR - stderr (14:08:47.126) - Thread-71 (f) (15936):
:
ERROR - stderr (14:08:47.135) - Thread-71 (f) (15936):
Traceback (most recent call last):
ERROR - stderr (14:08:47.145) - Thread-71 (f) (15936):
  File "threading.pyc", line 1045, in _bootstrap_inner
ERROR - stderr (14:08:47.164) - Thread-71 (f) (15936):
  File "threading.pyc", line 982, in run
ERROR - stderr (14:08:47.200) - Thread-71 (f) (15936):
  File "<console>", line 2, in f
ERROR - stderr (14:08:47.210) - Thread-71 (f) (15936):
ZeroDivisionError
ERROR - stderr (14:08:47.262) - Thread-71 (f) (15936):
:
ERROR - stderr (14:08:47.287) - Thread-71 (f) (15936):
division by zero

Expected behavior:

The following message should be logged instead.

Exception in thread Thread-71 (f):
Traceback (most recent call last):
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "<console>", line 2, in f
ZeroDivisionError: division by zero

NVDA logs, crash dumps and other attachments:

None

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

2024.1beta3

Windows version:

Windows 10 22H2 (AMD64) build 19045.3803

Name and version of other software in use when reproducing the issue:

N/A

Other information about your system:

N/A

Other questions

Does the issue still occur after restarting your computer?

Not re-tested but probably yes.

Have you tried any other versions of NVDA? If so, please report their behaviors.

  • NVDA 2023.3 (run from installer): No issue
  • nvda_snapshot_alpha-29722,b67e7f46 (run from installer): Issue reproduced

Thus the regression is between these two versions. But I have not been able to narrow down the range for now since running from source will require more time (only tested with installers for now).

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not tested

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions