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

fixes a race triggered by a removed wait condition in Xlib 1.7.3.1 (_XReply) #248

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

antis81
Copy link
Contributor

@antis81 antis81 commented Dec 22, 2021

fixes #247

While the original race condition was caused by a call to XSynchronize (in an async context!) the PR carries out quite some additional goodies.

Credits to @stefonarch @avallach200 and @tsujan for great support in sorting this one out!

@antis81
Copy link
Contributor Author

antis81 commented Dec 26, 2021

@avallach2000 Now the startup code behaves (again) exactly like before. Only it is a bit easier to follow the code! 😸
Can you give it another check? We should see the following line in the log:
X IO error ignored -> workaround for https://github.com/lxqt/lxqt-globalkeys/issues/247

Besides the fact that the execution order of start/run of both threads is not guaranteed this is not our issue here!

The only way I currently see on LXQt's side is to:

  1. Write our own IO error handler as a workaround and ignore the IO error on XPeekEvent/XNextEvent/…
  2. Communicate this to the Xorg dev's. As far as I understand it _XReadEvents should no longer interpret an empty event queue as _XIOError.

@tsujan Can you please review this also?

@antis81 antis81 changed the title quickfix for shitty written daemon initialization quickfix for removed wait condition in libx11 1.7.3 Dec 27, 2021
@avallach2000
Copy link

avallach2000 commented Dec 27, 2021

@antis81
I've applied updated version of your https://github.com/lxqt/lxqt-globalkeys/pull/248.patch. That's what you want me to test?

Now I don't see libX11 error message, but still see a warning from QSocketNotifier. Then daemon still exists with return value of 1.

[Info] enableAction id:18 enabled:true
[Info] registerClientAction shortcut:'Control+F1' path:'/panel/desktopswitch/desktop_11' description:'Перемкнутися до стільниці 11'
[Info] X IO error ignored -> workaround for https://github.com/lxqt/lxqt-globalkeys/issues/247
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
[Info] addClientAction shortcut:'Alt+F2' path:'/runner/show_hide_dialog' description:'Показати/сховати діалог запускача' sender:':1.20'
[Info] X IO error ignored -> workaround for https://github.com/lxqt/lxqt-globalkeys/issues/247
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread

I think that we can't workaround this error in a such way - exit(1) is caused by XPeekEvent() itself, not by lxqt-globalkeysd, so we cannot ignore an error in any way, no matter how error handler is written.
EDIT: After reading this, I've figured out what you are trying to do.

Just an assumption: maybe we can disable simultaneous XSendEvent() and XPeekEvent() calls by adding a mutex around XQuery or something like that? These functions are called from different threads and can be called simultaneously. It still seems to me that this is the root of our problem.

Here's how the main loop looks like after putting some fprintf(stderr, .., syscall(SYS_gettid)) into the code (I've also applied a previous version of your pull request before that):

$ ./lxqt-globalkeysd
tid=10761 XPeekEvent
tid=10758 XSendEvent
tid=10761 XNextEvent line=134x
--------
..
--------
tid=10761 XPeekEvent
tid=10758 XSendEvent
tid=10761 XNextEvent line=134x
--------
tid=10758 XSendEvent
tid=10761 XPeekEvent
The X11 connection broke: No error (code 0)
X connection to :0 broken (explicit kill or server shutdown).
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
$ ./lxqt-globalkeysd
tid=10835 XPeekEvent
tid=10832 XSendEvent
tid=10835 XNextEvent line=134x
--------
tid=10835 XPeekEvent
tid=10832 XSendEvent
The X11 connection broke: No error (code 0)
X connection to :0 broken (explicit kill or server shutdown).
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

@avallach2000 Thanks for providing the log! 👍 With that information we can now talk to the Xlib dev's. I am sure they can fix it without having to revert the patch (which I assume is correct, but incomplete).
(The QSocketNotifier warning is unrelated in this context. However it is to be taken serious! One step at a time…)

@tsujan As far as I understand we cannot actually do anything here as the socket connection is shut down by libx11/libxcb internally in such case. The case where XEvent pointer can actually become NULL is in libxcb - called via xcb_wait_for_event in libx11. The 1 exit code we see is likely (not completely sure) XCB_CONN_ERROR.

@tsujan
Copy link
Member

tsujan commented Dec 27, 2021

As far as I understand we cannot actually do anything here

I didn't want to sound pessimistic, especially when others tried to do something from a different perspective, but that was my opinion from start. It's based on the available evidence but not something I'm 100% sure about.

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

@tsujan Actually we are both wrong! 🎉 😆 As @avallach2000 stated earlier wakeX11Thread causes our race condition during shortcut registration at startup (follow addOrRegisterClientAction)! The logs further proof this:

…
[Info] registerClientAction shortcut:'Control+F1' path:'/panel/desktopswitch/desktop_11' description:'Перемкнутися до стільниці 11'
[Info] X IO error ignored -> workaround for https://github.com/lxqt/lxqt-globalkeys/issues/247
…

Hence tables just turned and we can actually fix it.

@tsujan
Copy link
Member

tsujan commented Dec 27, 2021

I won't interfere with this. My opinion is as before.

@avallach2000
Copy link

@antis81
Sorry, maybe I can't understand it with my qualification (which is rather low in c/c++), but xcb thread seems to be ok on exit() time:

Thread 4 (Thread 0x7ffff0f17640 (LWP 15143) "Core"):
#0  0x00007ffff61d1630 in exit () at /usr/lib/libc.so.6
#1  0x00007ffff7e7c015 in _XDefaultIOErrorExit (dpy=<optimized out>, user_data=<optimized out>) at XlibInt.c:1277
#2  0x00007ffff7e7c39b in _XIOError (dpy=dpy@entry=0x7fffe8004a10) at XlibInt.c:1552
#3  0x00007ffff7e79afd in _XReadEvents (dpy=dpy@entry=0x7fffe8004a10) at xcb_io.c:487
#4  0x00007ffff7e6aa69 in XPeekEvent (dpy=0x7fffe8004a10, event=0x7ffff0f16ba0) at PeekEvent.c:46
#5  0x000055555556a903 in Core::runEventLoop(unsigned long) (this=0x7fffffffdd50, rootWindow=379) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:1055
#6  0x000055555556a6f4 in Core::run() (this=0x7fffffffdd50) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:1025
#7  0x00007ffff67a87e8 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007ffff6134259 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff62905e3 in clone () at /usr/lib/libc.so.6

Thread 3 (Thread 0x7ffff1718640 (LWP 15142) "QDBusConnection"):
#0  0x00007ffff6285b2f in poll () at /usr/lib/libc.so.6
#1  0x00007ffff74ed749 in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007ffff7496c11 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007ffff699a18a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007ffff694726b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007ffff67ab9a6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007ffff7ce63d9 in  () at /usr/lib/libQt5DBus.so.5
#7  0x00007ffff67a87e8 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007ffff6134259 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff62905e3 in clone () at /usr/lib/libc.so.6

Thread 2 (Thread 0x7ffff2d9c640 (LWP 15141) "QXcbEventQueue"):
#0  0x00007ffff6285b2f in poll () at /usr/lib/libc.so.6
#1  0x00007ffff616b63b in  () at /usr/lib/libxcb.so.1
#2  0x00007ffff616d37b in xcb_wait_for_event () at /usr/lib/libxcb.so.1
#3  0x00007ffff2f599b2 in  () at /usr/lib/libQt5XcbQpa.so.5
#4  0x00007ffff67a87e8 in  () at /usr/lib/libQt5Core.so.5
#5  0x00007ffff6134259 in start_thread () at /usr/lib/libpthread.so.0
#6  0x00007ffff62905e3 in clone () at /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff35fb580 (LWP 15137) "lxqt-globalkeys"):
#0  0x00007ffff6285b2f in poll () at /usr/lib/libc.so.6
#1  0x000055555556a20f in Core::waitForX11Error(int, unsigned int) (this=0x7fffffffdd50, level=5, timeout=10) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:936
#2  0x000055555556a41e in Core::checkX11Error(int, unsigned int) (this=0x7fffffffdd50, level=5, timeout=10) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:978
#3  0x000055555556a4df in Core::wakeX11Thread() (this=0x7fffffffdd50) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:995
#4  0x000055555556d647 in Core::remoteStringToKeycode(QString const&) (this=0x7fffffffdd50, str=...) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:1715
#5  0x000055555556e412 in Core::ShortcutToX11(QString const&) (this=0x7fffffffdd50, shortcut=...) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:1927
#6  0x000055555556e762 in Core::checkShortcut(QString const&, QPair<unsigned char, unsigned int>&) (this=0x7fffffffdd50, shortcut=..., X11shortcut=...) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:1988
#7  0x000055555556ebbc in Core::addOrRegisterClientAction(QString const&, QDBusObjectPath const&, QString const&, QString const&) (this=0x7fffffffdd50, shortcut=..., path=..., description=..., sender=...) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:2033
#8  0x000055555556f94d in Core::registerClientAction(QString const&, QDBusObjectPath const&, QString const&) (this=0x7fffffffdd50, shortcut=..., path=..., description=...) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:2126
#9  0x0000555555566676 in Core::start() (this=0x7fffffffdd50) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/core.cpp:661
#10 0x0000555555562ebb in main(int, char**) (argc=1, argv=0x7fffffffdf88) at /home/jdoe/lxqt-globalkeys-1.0.0/daemon/main.cpp:239

Somehow it still falls to built-in libX11's XIOErrorHandler on XPeekEvent() (despite of your patch). Why does it happen?
Also, is there a better way to see when it breaks? Al least better than break exit, which I used to get the above backtrace?

@avallach2000
Copy link

avallach2000 commented Dec 27, 2021

@antis81

The logs further proof this

What about addClientAction? Are they similar?

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

I won't interfere with this. My opinion is as before.

And yet this is incorrect:
Just like in Qt the event queue cannot be written to reliably by different threads (especially not when dealing with pointers/references). Now if libX11 sees an event from another thread (our second connection actually) it will correctly ignore it in "this thread" and expects to handle events separately. Have a look here, here and here).

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

@avallach2000 This is what I mean: addClientAction (main thread) locks the mutex (neither addOrRegister… nor wakeX11Thread to prevent a dead-lock situation!). Since XPeekEvent is blocking, our Core::run thread should "wait" for an XEvent to occur. Since the actual dead-lock in X is solved now in libX11 I think we actually do not need to "wake" X11 by sending a fake event any more. Can you turn wakeX11Thread into a "no-op" and try again? E.g.:

void Core::wakeX11Thread() {
#if 0
  …
#endif
}

@avallach2000
Copy link

@antis81
That's what I got:

$ ./lxqt-globalkeysd --log-level=debug
[Info] registerClientAction shortcut:'' path:'/panel/taskbar/task_4' description:'Запустити завдання 4'
[Info] addClientAction shortcut:'' id:1
[Info] enableAction id:1 enabled:true
...
[Info] registerClientAction shortcut:'' path:'/panel/desktopswitch/desktop_1' description:'Desktop 1'
[Info] addClientAction shortcut:'' id:32
[Info] enableAction id:32 enabled:true
[Debug] Config file: /home/jdoe/.config/lxqt/globalkeyshortcuts.conf
[Debug] MinLogLevel: Debug
[Debug] MultipleActionsBehaviour: first
[Debug] AllowGrabLocks: false
[Debug] AllowGrabBaseSpecial: false
[Debug] AllowGrabMiscSpecial: true
[Debug] AllowGrabBaseKeypad: true
[Debug] AllowGrabMiscKeypad: true
[Notice] Started
[Info] addClientAction shortcut:'' path:'/panel/desktopswitch/desktop_1' description:'Перемкнутися до стільниці 1' sender:':1.23'
[Info] addClientAction shortcut:'' path:'/panel/desktopswitch/desktop_10' description:'Перемкнутися до стільниці 10' sender:':1.23'
[Info] addClientAction shortcut:'' path:'/runner/show_hide_dialog' description:'Показати/сховати діалог запускача' sender:':1.20'
[Info] addClientAction shortcut:'XF86Sleep' path:'/powermanager/keyhibernate' description:'Дія клавіші режиму сну' sender:':1.30'
^C[Critical] Cannot read from X11 response pipe: Перерваний системний виклик
[Warning] Cannot extract keycode and modifiers from shortcut 'XF86Sleep'
[Info] addClientAction shortcut:'XF86PowerOff' path:'/powermanager/keypoweroff' description:'Дія клавіші живлення' sender:':1.30'
^C[Critical] Cannot read from X11 response pipe: Перерваний системний виклик
[Warning] Cannot extract keycode and modifiers from shortcut 'XF86PowerOff'
[Info] addClientAction shortcut:'XF86Suspend' path:'/powermanager/keysuspend' description:'Дія клавіші призупинення' sender:':1.30'
^C[Critical] Cannot read from X11 response pipe: Перерваний системний виклик
[Warning] Cannot extract keycode and modifiers from shortcut 'XF86Suspend'
[Info] addClientAction shortcut:'Control+F1' path:'/panel/desktopswitch/desktop_11' description:'Перемкнутися до стільниці 11' sender:':1.23'
^C[Critical] Cannot read from X11 response pipe: Перерваний системний виклик
[Warning] Cannot extract keycode and modifiers from shortcut 'Control+F1'
[Info] addClientAction shortcut:'' path:'/panel/desktopswitch/desktop_12' description:'Перемкнутися до стільниці 12' sender:':1.23'
[Info] addClientAction shortcut:'' path:'/panel/desktopswitch/desktop_2' description:'Перемкнутися до стільниці 2' sender:':1.23'
[Info] addClientAction shortcut:'' path:'/panel/desktopswitch/desktop_3' description:'Перемкнутися до стільниці 3' sender:':1.23'
[Info] addClientAction shortcut:'Control+F2' path:'/panel/desktopswitch/desktop_4' description:'Перемкнутися до стільниці 4' sender:':1.23'

The only way to terminate daemon after that is to send SIGKILL.

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

The only way to terminate daemon after that is to send SIGKILL.

Which means the daemon is running just fine. :slight_smile:

EDIT: Those "[Critical]" messages you see origin from Core::checkShortcut (called from within - tada 🎉 - addOrRegisterShortcut). Now we see the whole ugly picture! Since our "XEvent listener" thread is already running at this point, XPeekEvent waits for events - logically the thread cannot at the same time send requests or receive responses on the X pipes. I think I can solve this.

@avallach2000
Copy link

Those "[Critical]" messages

But they are caused by SIGTERM (Ctrl-C). Didn't I confuse you even more?

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

Logical: lxqt-globalkeysd is designed to run "forever" in the background (living in lxqt-session). It does not quit until
a) session is closed (logout or shutdown)
b) manually killed or aborted (only relevant for development)
d) crash (coredump)
e) graceful exit (our very case here)

Replacing the #if 0 with the following code should improve the situation (I have pushed this):

void Core::wakeX11Thread()
{
    if (currentThread() != qApp->thread()) {
        log(LOG_DEBUG, "Core::wakeX11Thread can only be called from main thread");
        return;
    }
    if (mInterClientCommunicationWindow)
    …

Note that our "listener thread" is always awake when calling this function (Why send/receive events during event handling?).

Could you pull and check if it still races? (In best case you should see the log message in debug output and it no longer races.)

@avallach2000
Copy link

avallach2000 commented Dec 27, 2021

No luck. Never saw the mentioned debug message. Here's the shortest of my tries:

$ ./lxqt-globalkeysd --log-level=debug
[Info] registerClientAction shortcut:'Alt+F1' path:'/panel/mainmenu/show_hide' description:'Показати/сховати головне меню'
[Info] addClientAction shortcut:'Alt+F1' id:1
[Info] enableAction id:1 enabled:true
[Info] registerClientAction shortcut:'Alt+F2' path:'/runner/show_hide_dialog' description:'Показати/сховати діалог запускача'
[Info] addClientAction shortcut:'Alt+F2' id:2
[Info] enableAction id:2 enabled:true
[Info] registerClientAction shortcut:'Control+Alt+D' path:'/panel/showdesktop/show_hide' description:'Показати стільницю'
[Info] addClientAction shortcut:'Control+Alt+D' id:3
[Info] enableAction id:3 enabled:true
[Info] addCommandAction shortcut:'Control+Alt+E' command:'pcmanfm-qt' arguments:'' description:'Pcmanfm'
[Info] X IO error ignored -> workaround for https://github.com/lxqt/lxqt-globalkeys/issues/247
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread

EDIT: I've used fresh config for this, when using the old one it fails after registerClientAction or addClientAction.
EDIT2: Triplechecked everything. (currentThread() != qApp->thread()) never becomes True.

@antis81
Copy link
Contributor Author

antis81 commented Dec 27, 2021

Thanks!

Triplechecked everything. (currentThread() != qApp->thread()) never becomes True.

Yeah, because everything happens in Core::start() here and here.

The XFlush() call also looks suspicious (also why is it suddenly unlocked?). I will add log output around those places to better locate the error.

@avallach2000
Copy link

avallach2000 commented Dec 27, 2021

That's not very useful, it's too asynchronous:

@antis81
Copy link
Contributor Author

antis81 commented Dec 28, 2021

Now we know that XFlush is not being called bfore _XIOError happens. (I did not log what happens in checkX11Error()). That's useful information don't you think?

Let's put more logging around XPeekEvent to get more details on that. I expect we'll see this:

XSendEvent [0]
XSendEvent [1]
(no XFlush [0/1])
XPeekEvent [0]
[Critical] X IO error…

- XInitThreads (and X object creation) is correctly done in main thread.
- No longer segfaults when another daemon is already running.
@antis81 antis81 changed the title quickfix for removed wait condition in libx11 1.7.3 fix for removed wait condition in libx11 1.7.3 Dec 28, 2021
@antis81
Copy link
Contributor Author

antis81 commented Dec 28, 2021

@avallach2000 After disabling the XFlush call completely and it seems stable for me now. Currently I don't have an idea to provoke the race other than like running the process again and again and write every information we can get to the log. Maybe not the best method to debug such stuff.

@tsujan I cannot see any side effects by not calling XFlush explicitly after XSendEvent (plus checkX11Error -> reads back the error pipe). Note that in libX11 XFlush does not lock their internal mutex while XPeekEvent does lock. Since we call XFlush from another thread than XPeekEvent (and the latter also flushes), removing it may actually have fixed our race…

@avallach2000
Copy link

avallach2000 commented Dec 28, 2021

@antis81
Disabling XFlush doesn't fix this for me. I still see the old behavior:
log0.txt
log1.txt

[Info] addCommandAction shortcut:'Control+Alt+T' id:5                                                                                                       
[Info] enableAction id:5 enabled:true                                                                                                                       
[Info] registerClientAction shortcut:'Control+F1' path:'/panel/desktopswitch/desktop_1' description:'Перемкнутися до стільниці 1'                           
[Debug] Core::wakeX11Thread XSendEvent [0]                                                                                                                  
[Debug] Core::run -> XPeekEvent [waiting…][Debug] Core::wakeX11Thread XSendEvent [1]                                                                        
[Debug] Core::checkX11Error -> waitForX11Error [0]                                                                                                          
                                                                                                                                                            
[Debug] Core::run -> XPeekEvent [event]                                                                                                                     
[Debug] Core::checkX11Error -> waitForX11Error [1]                                                                                                          
[Debug] Core::checkX11Error -> waitForX11Error [0]                                                                                                          
[Debug] Core::checkX11Error -> waitForX11Error [1]                                                                                                          
[Debug] Core::wakeX11Thread XSendEvent [0]                                                                                                                  
[Debug] Core::run -> XPeekEvent [waiting…]                                                                                                                  
[Debug] Core::wakeX11Thread XSendEvent [1]                                                                                                                  
[Debug] Core::checkX11Error -> waitForX11Error [0]                                                                                                          
[Critical] X IO error -> May be issue https://github.com/lxqt/lxqt-globalkeys/issues/247                                                                    
The X11 connection broke: No error (code 0)                                                                                                                 
X connection to :0 broken (explicit kill or server shutdown).                                                                                               
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread

@avallach2000
Copy link

@antis81

Maybe not the best method to debug such stuff.

Unsure if it helps, but I attached a couple of trace logs created with ltrace -C -f -r -o ltrace.log ./lxqt-globalkeysd --log-level=debug. They are definitely more detailed than anything we can achieve with regular logging.

Second column is relative time, so you can use something like
sort -k2 ltrace0.log | grep -Pie "(mutex|xsend|xpeek|xnext|poll|thread|vfprintf)"
to see the full picture across the time.

@antis81
Copy link
Contributor Author

antis81 commented Dec 30, 2021

@avallach2000 Could you re-check this please? According to what @tsujan found in this comment putting a mutex locker inside "waitForX11Error" now changes the locking behaviour "on our side" and (there's slight chance this has a positive effect for our issue).

@avallach2000
Copy link

avallach2000 commented Dec 30, 2021

I don't see any changes. Helgrind's output looks practically the same, except for two new
Thread #1: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread
warnings:
hg.20211230_1758.log

@antis81
Copy link
Contributor Author

antis81 commented Dec 30, 2021

Thank you again! FYI: That "broadcast" warning is likely from this one. In case you don't know already:

  • Our mDisplay (dpy in libX11) represents the X connection
  • dpy->xcb->event_notify is also a mutex and has to be handled complely by libX11

Also looking at the thread setup: Why do we have 4 threads (I'd expect 3)?
I will give the core thread an "object name", so we better know which is which.

Seems to work. Please test it well so we don't introduce anything harmful!
@antis81
Copy link
Contributor Author

antis81 commented Dec 30, 2021

@avallach2000 Have another one ready for testing. I flipped the "data" mutex logic. Does this reveal anything to the helgrind log?

This change is a little "brave"! If it doesn't work I am ready to revert a19fd41 completely. @tsujan Would be also happy to get your feedback on this.

@avallach2000
Copy link

avallach2000 commented Dec 30, 2021

@antis81 It seems now we have more attempts to unlock non-locked locks, but less recursive write lock warnings.
hg.20211230_2020.log

Am I right that you can't reproduce such behavior on your system?

@antis81
Copy link
Contributor Author

antis81 commented Dec 31, 2021

@avallach2000 Reproducing the behaviour is difficult as it occurs somewhat rare on my system (similar to @tsujan setup).

Found a very old (like Qt3 era) article about GLX programming stating this:

…The simple solution is to call XInitThreads() before creating the QApplication object in your program. XInitThreads() must be the first Xlib call made in an application for it to work reliably. This will in effect make Xlib thread-safe.…

Thought about that for some time now since QApplication also utilizes XCB/Xlib. At least it does no harm.

@antis81
Copy link
Contributor Author

antis81 commented Jan 1, 2022

@avallach2000 Can you "bulk run" this again please? Seems to work on my system.

@avallach2000
Copy link

avallach2000 commented Jan 1, 2022

It seems to work fine.
EDIT: I stopped after 50 successful launches. Don't want to test it anymore))

@antis81 antis81 changed the title fix for removed wait condition in libx11 1.7.3 fix for removed wait condition in Xlib 1.7.3 Jan 1, 2022
@antis81 antis81 changed the title fix for removed wait condition in Xlib 1.7.3 fixes a race triggered by a removed wait condition in Xlib 1.7.3.1 (_XReply) Jan 1, 2022
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.

Shortcuts Ignored After Upgrade
3 participants