Emulator Issues #12253

Deadlock when turning off Wii Remote when using Connect Wii Remotes for Emulated Controllers

Added by JosJuice 17 days ago. Updated 9 days ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


Game Name?

I used Rodea the Sky Soldier (SROKZ5), but any Wii game should work

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


What's the problem? Describe what went wrong.

If you turn off a Wii Remote while Connect Wii Remotes for Emulated Controllers is enabled and a game is running, the game freezes. (Dolphin's UI will subsequently also freeze if you try to do anything that locks the core, such as exiting emulation.)

What steps will reproduce the problem?

  1. Turn on Connect Wii Remotes for Emulated Controllers and set up an Emulated Wii Remote. (I used the default mapping you get in a blank Dolphin install.)
  2. Connect a Wii Remote to Dolphin.
  3. Launch any Wii game.
  4. While the game is running, turn off the Wii Remote by holding down its power button.

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

Yes, 5.0-12579.

Is the issue present in the latest stable version?

No, because it does not have the Connect Wii Remotes for Emulated Controllers feature.

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 and anyone who is building Dolphin on their own can use git bisect.)

JMC bisected it to the version that added Connect Wii Remotes for Emulated Controllers.

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

Windows 10

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

Below are stack traces of the two threads that are mutually deadlocked.

ciface::Win32 message loop:

[External Code] 
[Inline Frame] Dolphin.exe!std::_Mutex_base::lock() Line 51 C++
[Inline Frame] Dolphin.exe!std::lock_guard<std::recursive_mutex>::{ctor}(std::recursive_mutex &) Line 436   C++
Dolphin.exe!ciface::Core::DeviceContainer::FindDevice(const ciface::Core::DeviceQualifier & devq) Line 183  C++
Dolphin.exe!ciface::ExpressionParser::ControlEnvironment::FindOutput(ciface::ExpressionParser::ControlQualifier qualifier) Line 426 C++
Dolphin.exe!ciface::ExpressionParser::ControlExpression::UpdateReferences(ciface::ExpressionParser::ControlEnvironment & env) Line 222  C++
Dolphin.exe!ControllerEmu::EmulatedController::UpdateReferences(ciface::ExpressionParser::ControlEnvironment & env) Line 55 C++
Dolphin.exe!ControllerEmu::EmulatedController::UpdateReferences(const ControllerInterface & devi) Line 47   C++
[External Code] 
[Inline Frame] Dolphin.exe!std::_Func_class<void>::operator()() Line 976    C++
Dolphin.exe!ControllerInterface::InvokeDevicesChangedCallbacks() Line 301   C++
Dolphin.exe!ControllerInterface::RemoveDevice(std::function<bool __cdecl(ciface::Core::Device const *)> callback) Line 249  C++
Dolphin.exe!ciface::DInput::PopulateDevices(HWND__ * hwnd) Line 58  C++
Dolphin.exe!WindowProc(HWND__ * hwnd, unsigned int message, unsigned __int64 wparam, __int64 lparam) Line 32    C++
[External Code] 
Dolphin.exe!`ciface::Win32::Init'::`2'::<lambda_1>::operator()() Line 113   C++
[External Code] 

CPU thread:

[External Code] 
[Inline Frame] Dolphin.exe!std::_Mutex_base::lock() Line 51 C++
[Inline Frame] Dolphin.exe!std::lock_guard<std::mutex>::{ctor}(std::mutex &) Line 436   C++
Dolphin.exe!ControllerInterface::InvokeDevicesChangedCallbacks() Line 300   C++
Dolphin.exe!ControllerInterface::RemoveDevice(std::function<bool __cdecl(ciface::Core::Device const *)> callback) Line 249  C++
Dolphin.exe!ciface::Wiimote::Device::UpdateInput() Line 1374    C++
Dolphin.exe!ControllerInterface::UpdateInput() Line 259 C++
Dolphin.exe!SerialInterface::UpdateDevices() Line 659   C++
Dolphin.exe!VideoInterface::Update(unsigned __int64 ticks) Line 870 C++
Dolphin.exe!SystemTimers::`anonymous namespace'::VICallback(unsigned __int64 userdata, __int64 cyclesLate) Line 136 C++
Dolphin.exe!CoreTiming::Advance() Line 327  C++
[External Code] 


#1 Updated by godisgovernment 17 days ago

the problematic locks are:
ciface thread holds m_callbacks_mutex while cpu thread waits for it
cpu thread holds m_devices_mutex while ciface thread waits for it

#2 Updated by Billiard26 9 days ago

  • Assignee set to Billiard26

Also available in: Atom PDF