Recent

Author Topic: SIGSEGV on exiting application under QT5.6  (Read 7773 times)

alanphys

  • New member
  • *
  • Posts: 39
SIGSEGV on exiting application under QT5.6
« on: January 10, 2018, 01:38:10 pm »
Hi

I've recently installed Fedora 26 with KDE 5 and QT 5.6 on a new system. I managed to build and install libQt5Pas.so as per the wiki and rebuild Lazarus for QT5. My applications compile and run in the debugger correctly. The only thing is that when I exit my application while running it in Lazarus I get a SIGSEGV error and Lazarus remains in debugging mode and I have to stop the application manually. This occurs whether I have debugging enabled (-gw) or not. If I run the applications outside Lazarus they appear to exit cleanly. The same applications exited properly on my previous Fedora 24 with KDE4 and Windows systems.

This issue is trivial, but annoying and I don't know enough about Lazarus to fault find. Any pointers or tips will be welcome.
Alanphys

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3609
  • I like bugs.
Re: SIGSEGV on exiting application under QT5.6
« Reply #1 on: January 10, 2018, 02:45:23 pm »
I get the same SIGSEGV also with QT4 bindings. I tried to find the reason but could not.
See thread "How is EntryInformation.OS.haltproc assigned?" in FPC-Pascal mailing list:
 http://readlist.com/lists/lists.freepascal.org/fpc-pascal/8/42964.html
Zeljko (LCL-QT maintainer) gets it only with QT5.
How to fix it? Nasty bug.

alanphys

  • New member
  • *
  • Posts: 39
Re: SIGSEGV on exiting application under QT5.6
« Reply #2 on: January 10, 2018, 03:01:58 pm »
I didn't have this problem with the QT 4 bindings, but I had to downgrade the debugger (gdb) due to a host of other problems. I'll track down the previous debugger version I used and see if I still have the problem.
Alanphys

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #3 on: January 11, 2018, 12:10:25 pm »
Problem is that usually with Qt5 I cannot get AV on application terminate when running under gdb. It just happens after closing app and gdb cannot catch that part. Didn't find any way to even have an idea about problem. On the other hand, when using Qt5 under win32, never had such AV on app termination.

baldzhang

  • New member
  • *
  • Posts: 24
Re: SIGSEGV on exiting application under QT5.6
« Reply #4 on: January 23, 2018, 11:51:20 pm »
Hi zeljko

I met this problem in slackware-current/qt5, from 5.7 to 5.9.3.
after any program exit, include lazarus ide, there will be AV and some callstack dumped.
1.8.0 and trunk(r59141) is the same.

following is something maybe helpful
----------------------------------BEGIN----------------------------------------------------------
(gdb) r
Starting program: /root/work/devel/2/nxdlinux/mgr/nlmgr
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[New Thread 0x7fffeab8a700 (LWP 1847)]
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[New Thread 0x7fffe0c61700 (LWP 1848)]
[New Thread 0x7fffdbfff700 (LWP 1849)]
[New Thread 0x7fffd9a88700 (LWP 1852)]

Thread 1 "nlmgr" received signal SIGSEGV, Segmentation fault.
0x00007ffff6eca979 in _dl_catch_error () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6eca979 in _dl_catch_error () at /lib64/libc.so.6
#1  0x00007ffff79b45c5 in _dlerror_run () at /lib64/libdl.so.2
#2  0x00007ffff79b3fff in dlclose () at /lib64/libdl.so.2
#3  0x00007ffff5150e03 in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007ffff514ae6d in  () at /usr/lib64/libQt5Core.so.5
#5  0x00007ffff513bd92 in  () at /usr/lib64/libQt5Core.so.5
#6  0x00007ffff513bed9 in  () at /usr/lib64/libQt5Core.so.5
#7  0x00007ffff518a1a3 in QObject::~QObject() () at /usr/lib64/libQt5Core.so.5
#8  0x00007ffff5a96d49 in  () at /usr/lib64/libQt5Gui.so.5
#9  0x00007ffff6daddd8 in __run_exit_handlers () at /lib64/libc.so.6
#10 0x00007ffff6dade2a in  () at /lib64/libc.so.6
#11 0x00007ffff6d94031 in __libc_start_main () at /lib64/libc.so.6
#12 0x0000000000000000 in  ()
-----------------------------------END--------------------------------------------------------------

I'm not sure to report an issue, you may have a look first.

If you need more details or some test, just give me a message.

Thanks you and lazarus team.

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #5 on: January 24, 2018, 12:52:23 pm »
Last night I've got understandable stack dump too...with Qt-5.9.2.No matter if it's simple app with one form or huge project - stack dump is always same, and it happens in QObject destructor, so dont know if it's something about our C bindings or Qt bug.
#0  0x00007ffff6cc016c in _dl_catch_error () from /lib64/libc.so.6
#1  0x00007ffff79b46a5 in _dlerror_run () from /lib64/libdl.so.2
#2  0x00007ffff79b401f in dlclose () from /lib64/libdl.so.2
#3  0x00007ffff5c621b3 in QLibraryPrivate::unload_sys() () from /lib64/libQt5Core.so.5
#4  0x00007ffff5c5de3d in QLibraryPrivate::unload(QLibraryPrivate::UnloadFlag) () from /lib64/libQt5Core.so.5
#5  0x00007ffff5c4f732 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate() () from /lib64/libQt5Core.so.5
#6  0x00007ffff5c4f879 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate() () from /lib64/libQt5Core.so.5
#7  0x00007ffff5c9643a in QObject::~QObject() () from /lib64/libQt5Core.so.5
#8  0x00007ffff5c4eb4b in QFactoryLoader::~QFactoryLoader() () from /lib64/libQt5Core.so.5
#9  0x00007ffff6199749 in (anonymous namespace)::Q_QGS_loader::innerFunction()::Holder::~Holder () from /lib64/libQt5Gui.so.5
#10 0x00007ffff6ba5fc8 in __run_exit_handlers () from /lib64/libc.so.6
#11 0x00007ffff6ba601a in exit () from /lib64/libc.so.6
#12 0x00007ffff6b8b891 in __libc_start_main () from /lib64/libc.so.6
#13 0x0000000000000000 in ?? ()

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan

baldzhang

  • New member
  • *
  • Posts: 24
Re: SIGSEGV on exiting application under QT5.6
« Reply #7 on: January 24, 2018, 07:21:53 pm »
but....
on the same time, it's all ok in Arch...

I did not compare glibc different between them, only confirmed they are all version 2.26

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #8 on: January 25, 2018, 01:48:35 pm »
If that error doesn't trigger under arch then it's obvious that we cannot fix it inside lcl code. So, that could be glibc bug, but also Qt bug which is fixed by distro maintainer (if we are about same Qt versions on different distros).

baldzhang

  • New member
  • *
  • Posts: 24
Re: SIGSEGV on exiting application under QT5.6
« Reply #9 on: January 25, 2018, 02:29:38 pm »
Ok, I will do more test and may report a bug to slackware maintainer

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #10 on: January 25, 2018, 09:16:50 pm »
It's not Qt5 only, I have error when closing Qt4 app on Fedora 26.
Last night I've upgraded from Fedora 25 (Qt-5.7.1, Qt-4.8.7) to Fedora 26 (Qt-5.9.2, Qt-4.8.7) and now have segfaults when app is closed.

baldzhang

  • New member
  • *
  • Posts: 24
Re: SIGSEGV on exiting application under QT5.6
« Reply #11 on: January 25, 2018, 11:17:48 pm »
I do a test on slackware x86_64 14.2 with QT 5.7.1 today, it's good. and QT4 never met this issue on my systems(include slackware and arch)
already posted at linuxquestions.net, but no response for now...

BTW I was saw printer related strings in backtrace once and I haven't print service installed.

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #12 on: January 27, 2018, 10:53:28 am »
What exact printer related strings ? Can you paste console output here ?

zeljko

  • Hero Member
  • *****
  • Posts: 1044
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: SIGSEGV on exiting application under QT5.6
« Reply #13 on: January 27, 2018, 11:58:10 am »
Seem that adding QCoreApplication_destroy(QCoreApplication_instance()) in TQtWidgetSet.Destroy (just before inherited Destroy) fixes segfault with Qt4 under newer distros, but Qt5 definitelly have other problem , segfault comes after QCoreApplication is destroyed

baldzhang

  • New member
  • *
  • Posts: 24
Re: SIGSEGV on exiting application under QT5.6
« Reply #14 on: January 27, 2018, 02:57:51 pm »
The attachement is full backtrace of all exceptions.

In second one's bt, it say

(gdb) bt
#0  0x00007ffff6eca979 in _dl_catch_error () at /lib64/libc.so.6
#1  0x00007ffff79b45c5 in _dlerror_run () at /lib64/libdl.so.2
#2  0x00007ffff79b3fff in dlclose () at /lib64/libdl.so.2
#3  0x00007ffff5150e03 in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007ffff514ae6d in  () at /usr/lib64/libQt5Core.so.5
#5  0x00007ffff513bd92 in  () at /usr/lib64/libQt5Core.so.5
#6  0x00007ffff513bed9 in  () at /usr/lib64/libQt5Core.so.5
#7  0x00007ffff518a1a3 in QObject::~QObject() () at /usr/lib64/libQt5Core.so.5
#8  0x00007ffff6b3b3d9 in  () at /usr/lib64/libQt5PrintSupport.so.5
....


I already installed cups package, but not run cups daemon.
may not so related to printer, IMO.