Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
5.12.9, 5.15.2, 6.5.0 Beta2
-
None
-
OS : Linux Mint
Kernal : 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Also reproducted on Debian Buster and Bulleye.
Description
Hi,
I have detected a bug in QtBase when Qt is not compiled with glib support for event loop. The problem occurs when a program in using thread with event loop, is working as daemon (and when we are writing log in stderr.
I built a small application that reproduct the problem available here with all compilation steps : https://github.com/Jet1oeil/qt-test-service
After some investigation, i found that the problem probably concern the lines in qeventdispatcher_unix.cpp arround line 121.
# ifndef QT_NO_EVENTFD
if ((fds[0] = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC)) >= 0) {
qWarning("QThreadPipe:::init fd[0]=%d, fd[1]=%d", fds[0], fds[1]); return true; {color}}
# endif
In my observation, this function may return a file descriptor where value is 2 (stderr), and the problem is that when writing in stderr this issues a lot of events. I'm not able to tell if this is normal, to get an fd with value 2 or if it's a kernel bug.
And after this, we encounter multiple an infinite loop issuing this log.
QThreadPipe: internal error, wakeUps.testAndSetRelease(1, 0) failed!
{{}}
Note that is problem happend randomly depending if the fd is 2 or not, which in my case happend 4/5 times.
You will find in attachement two logs with a more verbose qt version, one where we obtain an fd = 2, and one where fd is not 2.
I hope i'm clear, I'm available for any question and help to fix this.
Regards,