Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX(client): Use SPSC queue for global shortcuts on Windows #5944

Merged

Conversation

davidebeatrici
Copy link
Member

We've been receiving quite a few reports about the program seemingly freezing, such as
https://forums.mumble.info/topic/14467-14-conflict-with-flight-control-rudder-pedals.

Turns out there are HID devices, namely advanced controllers, that constantly send packets.
The reason behind the behavior is probably to prevent games from losing track of the physical state.

Qt's event dispatcher blows up and consumes all resources, leading to:

QEventDispatcherWin32::registerTimer: Failed to create a timer (The current process has used all of its system allowance of handles for Window Manager objects.)

As a result, the UI completely freezes due to events not being processed anymore.
This commit fixes the issue by using an SPSC (Single Producer Single Consumer) queue.

The event loop and 20 ms timer are removed. The latter was strictly used for XInput and G-keys polling.
Both backends still work, potentially better than before: no more polling!
Whenever a HID message is received, the relevant code is executed.

@davidebeatrici davidebeatrici linked an issue Oct 29, 2022 that may be closed by this pull request
@davidebeatrici davidebeatrici changed the title MAINT: Add SPSCQueue as submodule FIX(client): Use SPSC queue for global shortcuts on Windows Oct 29, 2022
src/mumble/GlobalShortcut_win.cpp Outdated Show resolved Hide resolved
src/mumble/GlobalShortcut_win.cpp Outdated Show resolved Hide resolved
src/mumble/GlobalShortcut_win.cpp Outdated Show resolved Hide resolved
A bounded single-producer single-consumer wait-free and lock-free queue written in C++11.

It is going to be used for the Windows implementation of global shortcuts.
src/mumble/GlobalShortcut_win.cpp Show resolved Hide resolved
src/mumble/GlobalShortcut_win.h Outdated Show resolved Hide resolved
We've been receiving quite a few reports about the program seemingly freezing, such as
https://forums.mumble.info/topic/14467-14-conflict-with-flight-control-rudder-pedals.

Turns out there are HID devices, namely advanced controllers, that constantly send packets.
The reason behind the behavior is probably to prevent games from losing track of the physical state.

Qt's event dispatcher blows up and consumes all resources, leading to:

QEventDispatcherWin32::registerTimer: Failed to create a timer (The current process has used all of its system allowance of handles for Window Manager objects.)

As a result, the UI completely freezes due to events not being processed anymore.
This commit fixes the issue by using an SPSC (Single Producer Single Consumer) queue.

The event loop and 20 ms timer are removed. The latter was strictly used for XInput and G-keys polling.
Both backends still work, potentially better than before: no more polling!
Whenever a HID message is received, the relevant code is executed.
@Krzmbrzl Krzmbrzl merged commit bde29b6 into mumble-voip:master Dec 30, 2022
@davidebeatrici davidebeatrici deleted the globalshortcutwin-spsc-queue branch December 30, 2022 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.4.230 UI hangs/unresponsive
2 participants