-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
hack around Xlib deadlock #1923
Conversation
36a9c3d
to
d700ea5
Compare
d700ea5
to
8c7b955
Compare
Oops this breaks running with |
Otherwise calling Xlib functions segfaults when running as a Wayland client
I've cherry-pricked the commits for testing. But since I didn't experience the issue I can only test for any unwanted side effects. Running Mixxx with QtWayland never really worked, even without this patch. The UI is incomplete and Mixxx is unresponsive, so I won't test this use case. |
Yes the QPA Wayland backend has many issues that make it not ready for production. Just at first glance, high DPI scaling is somehow handled differently (a scale factor of 1.5 looks the same as 3.0 with X??) and my theme does not apply. I just wanted to make sure this didn't break running with the QPA Wayland backend any more than Qt is broken with it. I would not be surprised if it becomes the default in the future. |
src/mixxx.cpp
Outdated
@@ -81,10 +81,41 @@ | |||
#include "preferences/dialog/dlgprefmodplug.h" | |||
#endif | |||
|
|||
#ifdef Q_OS_LINUX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace all occurrences of #ifdef Q_OS_LINUX
in this patch with #if defined(Q_WS_X11)
that we already used for this purpose in other parts of Mixxx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find any documentation for Q_WS_X11 for Qt5. Conceptually it doesn't make sense. The window system is not determined at compile, but at runtime. I think Q_OS_LINUX is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you neither have X11 nor its development headers installed? This might not happen soon, but it will happen. We use Qt as an abstraction layer and usually it doesn't matter. But here the abstraction leaks through at compile time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can defer that until it becomes a real problem. If Qt doesn't help us when that comes, we'll have to detect the presence of X headers in our build system.
typedef Bool (*WireToErrorType)(Display*, XErrorEvent*, xError*); | ||
|
||
const int NUM_HANDLERS = 256; | ||
WireToErrorType __oldHandlers[NUM_HANDLERS] = {0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't get the magic behind this array. Which unknown side effect sets the elements to a value other than 0? Currently the error interceptor does nothing except ignoring and dropping all incoming extension errors. This can be implemented in a much simpler way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, neither do I, nor do I understand the magic number 256. I've never worked with X11 code before, much less understand X's internals. I just copied and pasted from https://bugs.freedesktop.org/show_bug.cgi?id=59361#c4 and got it to build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
256 because the error code is an unsigned char with values ranging from 0 to 255. But all slots are initialized with 0 (= nullptr
) and are never updated.
83e5780
to
02af45b
Compare
02af45b
to
8fa52d4
Compare
Missing dependency in .travis.yml! |
After installing qt5-qtx11extras-devel I get this build error:
This include works:
|
Next failure during linking:
|
Well this is interesting. That link error is because I switched from Q_WS_X11 to Q_OS_LINUX. I tested switching that ifdef back to Q_WS_X11 and adding a qWarning, and the qWarning was not printed, so it seems |
This was previously guarded by an #ifdef Q_WS_X11, but switching to Q_OS_LINUX caused a link error: /usr/bin/ld: lin64_build/mixxx.o: in function `MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&)': /home/uk/Projects/Mixxx/mixxx/src/mixxx.cpp:187: undefined reference to `qt_x11_wait_for_window_manager(QWidget*)' It turns out that Q_WS_X11 is no longer defined with Qt5, yet it does not seem that building Mixxx without the call to qt_x11_wait_for_window_manager has caused any issues, so I presume it is safe to remove it now. This was the only place in Mixxx where Q_WS_X11 was referenced.
libqt5x11extras5-dev is still missing in .travis.yml to fix the CI build |
Using the unmodified patch is feasible since we have no clue how the code actually is intended to work. As far as I understand it suppresses errors to avoid getting stuck at a subsequent lock. If this workaround is effective (what I'm not able to validate) I have no objections merging it. LGTM. |
I experienced no crash after playing for 1.5 hours. Of course that doesn't necessarily mean the problem is solved, but I'll keep testing. |
adapted code from https://gitlab.freedesktop.org/xorg/lib/libx11/issues/25#note_17248
https://bugs.launchpad.net/mixxx/+bug/1805559
I have not had time to extensively test this yet.