Project

General

Profile

Actions

Emulator Issues #12893

closed

Stop responding (freeze) when configuring keys with Tas Input's "Enable Controller Input" and Emulated Wii Remote

Added by Avasam about 2 years ago. Updated about 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
Yes
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
5.0-15203
Fixed in:
5.0-18857

Description

Game Name?

N/A

Game ID? (right click the game in the game list, Properties, Info tab)

N/A

MD5 Hash? (right click the game in the game list, Properties, Verify tab, Verify Integrity button)

N/A

What's the problem? Describe what went wrong.

Trying to configure controllers or hotkeys while Enable Controller Input is checked while a game is running causes Dolphin to stop responding.

What steps will reproduce the problem?

  1. Ensure you are using an Emulated Wii Remote
  2. Open a Wii game
  3. Open TAS Inputs
  4. Check "Enable Controller Input"
  5. Open "Controllers > Configure" OR "Options > Hotkey Settings"

Does not happen if no game is running.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

5.0-16101

Is the issue present in the latest stable version?

N/A (Enable Controller Input does not exist in 5.0)
However, it is not present in the oldest beta: 5.0-15105

If the issue isn't present in the latest stable version, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)

5.0-15203 https://dolphin-emu.org/download/dev/28e6e8752ce709a775440138a39bce6987624ec8/

If your issue is a graphical issue, please attach screenshots and record a three frame fifolog of the issue if possible. Screenshots showing what it is supposed to look like from either console or older builds of Dolphin will help too. For more information on how to use the fifoplayer, please check here: https://wiki.dolphin-emu.org/index.php?title=FifoPlayer

N/A

What are your PC specifications? (CPU, GPU, Operating System, more)

NVIDIA GeForce GTX 1070
AMD Ryzen 5 2600 Six-Core Processor
Windows 10.0.19044

Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)

N/A


Files

12893_call_stack.txt (7.25 KB) 12893_call_stack.txt Dentomologist, 08/31/2022 10:19 PM
Actions #1

Updated by JosJuice about 2 years ago

  • Milestone set to Current
  • Regression changed from No to Yes
  • Regression start set to 5.0-15203
Actions #2

Updated by Dentomologist over 1 year ago

This is caused by a deadlock between the CPU and Main threads. I've attached the full call stacks, but here's an abridged version.

CPU Thread (parent calls first):
IPC_HLE_UpdateCallback
...
WiiMoteEmu::WiiMote::Update, which calls GetStateLock
SendDataReport
...
TASInputWindow::GetSpinBoxU16
QueueOnObjectBlocking

Main Thread:
WiimoteControllersWidget::OnWiimoteConfigure
MappingWindow constructor
...
MappingButton constructor
RefToDisplayString, which calls GetStateLock

Sequence of events:

  • CPU Thread calls GetStateLock in Update
  • Main Thread calls GetStateLock in RefToDisplayString and blocks
  • CPU Thread calls QueueOnObjectBlocking from GetSpinBoxU16, which (when Enable Controller Input is set) queues a call of spin->setValue for the next time the Main Thread returns to its event loop. The CPU thread then blocks until the call of setValue returns, but that never happens because the Main thread is blocked on the call to GetStateLock which is never released by the CPU thread.

The simplest solution to this issue is to use QueueOnObject (which I've verified works) instead of QueueOnObjectBlocking, but then that presumably causes https://bugs.dolphin-emu.org/issues/12676 to happen again.

Actions #3

Updated by JosJuice over 1 year ago

  • Status changed from New to Accepted
Actions #4

Updated by JosJuice about 1 year ago

  • Status changed from Accepted to Fixed
  • Fixed in set to 5.0-18857
Actions

Also available in: Atom PDF