Skip to content

render: check the thread exit condition after every long operation#20097

Merged
DHowett merged 1 commit intomainfrom
dev/duhowett/dead-locks
Apr 9, 2026
Merged

render: check the thread exit condition after every long operation#20097
DHowett merged 1 commit intomainfrom
dev/duhowett/dead-locks

Conversation

@DHowett
Copy link
Copy Markdown
Member

@DHowett DHowett commented Apr 8, 2026

We have received an internal report that teardown on OneCore is still hanging. It looks like there's a chance that TriggerTeardown is called during PaintFrame, which may result in _threadShouldKeepRunning getting set to false (TriggerTeardown) and _redraw being set to false as well (PaintFrame). The thread will wait forever on _redraw to be signalled, which it never will, because TriggerTeardown is waiting for the thread to exit.

That is:

Render Thread      | ConIoSrv Thread
------------------------------------
Check _enabled     |
Wait on _redraw    |
Check _keepRunning | TriggerTeardown
Paint              |   _keepRunning = false
                   |   _redraw = true
    _redraw = false|   Signal _enabled
Paint Completes    |   Wait on thread
Check _enabled     |
Wait on _redraw    |
**DEADLOCK**       | **DEADLOCK**
                   v

This may not be an ideal fix, but at least it checks _threadShouldKeepRunning after every "long" operation (waiting and painting) now.

We have received an internal report that teardown on OneCore is still
hanging. It looks like there's a chance that `TriggerTeardown` is called
during `PaintFrame`, which may result in `_threadShouldKeepRunning`
getting set to `false` (TriggerTeardown) and `_redraw` being set to
`false` as well (PaintFrame). The thread will wait forever on `_redraw`
to be signalled, which it never will, because `TriggerTeardown` is
waiting for the thread to exit.

That is:

```
Render Thread      | ConIoSrv Thread
------------------------------------
Check _enabled     |
Wait on _redraw    |
Check _keepRunning | TriggerTeardown
Paint              |   _keepRunning = false
                   |   _redraw = true
    _redraw = false|   Signal _enabled
Paint Completes    |   Wait on thread
Check _enabled     |
Wait on _redraw    |
**DEADLOCK**       | **DEADLOCK**
                   v
```

This may not be an ideal fix, but at least it checks
`_threadShouldKeepRunning` after every "long" operation (waiting and
painting) now.
@DHowett DHowett requested a review from lhecker April 8, 2026 23:34
@DHowett DHowett merged commit a6ebdd3 into main Apr 9, 2026
20 checks passed
@DHowett DHowett deleted the dev/duhowett/dead-locks branch April 9, 2026 21:34
@stasyu2009-ux
Copy link
Copy Markdown

Hello everyone, I am a new employee in your company.

@stasyu2009-ux
Copy link
Copy Markdown

My job is a programmer, web development tester, website developer, and more.

@DHowett
Copy link
Copy Markdown
Member Author

DHowett commented Apr 13, 2026

Hello everyone, I am a new employee in your company.

Very poor social engineering attack.

@microsoft microsoft deleted a comment from stasyu2009-ux Apr 15, 2026
@microsoft microsoft deleted a comment from stasyu2009-ux Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants