Re: Qt 5.13: Segfault on exit with Windows + QtWebEngine

Florian Bruhin <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
On Wed, Jul 17, 2019 at 06:10:24PM +0200, Florian Bruhin wrote:
> On Wed, Jul 17, 2019 at 04:58:22PM +0100, Phil Thompson wrote:
> > On 17/07/2019 12:48, Florian Bruhin wrote:
> > > On Wed, Jul 17, 2019 at 11:54:10AM +0100, Phil Thompson wrote:
> > > > On 13/07/2019 16:43, Florian Bruhin wrote:
> > > > > With a quite minimal QtWebEngine example like this:
> > > > >
> > > > >     from PyQt5.QtWebEngineWidgets import QWebEngineProfile
> > > > >     from PyQt5.QtWidgets import QApplication
> > > > >     from PyQt5.QtCore import QTimer
> > > > >
> > > > >     qapp = QApplication([])
> > > > >     p = QWebEngineProfile()
> > > > >     QTimer.singleShot(500, qapp.quit)
> > > > >     qapp.exec_()
> > > > >
> > > > > I get a segfault on exit with Python 3.7.4 and PyQt5/PyQtWebEngine
> > > > > 5.13.0
> > > > > on Windows 10.
> > > > >
> > > > > When I downgrade to PyQt5 5.12.3 and PyQtWebEngine 5.12.1 things work
> > > > > fine.
> > > > >
> > > > > Unfortunately I haven't been able to get a reliable stacktrace. Here are
> > > > > some
> > > > > examples of the stacks I got:
> > > > > https://paste.the-compiler.org/view/5774da86
> > > > > I don't think they really make sense though.
> > > > 
> > > > I can't reproduce this - although I am using Python v3.7.0.
> > > 
> > > I can reproduce it with Python 3.7.0 as well (both 32 and 64-bit).
> > > 
> > > Note that I don't get a "Python.exe has stopped" window, but "echo $?"
> > > shows
> > > False in Powershell.
> > > 
> > > Similarly, running it from Python:
> > > 
> > >   subprocess.run([sys.executable, 'segv.py'], check=True)
> > > 
> > > Gives me:
> > > 
> > >   subprocess.CalledProcessError: Command '['...\\python.exe',
> > > 'segv.py']' returned non-zero exit status 3221225477.
> > > 
> > > Where 3221225477 is 0xC0000005, i.e. an access violation.
> > 
> > I can reproduce that. However if I build the latest PyQt against Qt v5.12.4
> > the problem goes away, which suggests a Qt problem. I can only suggest
> > playing with things to try and get things destroyed in a different order,
> > then I might be able to add a workaround.
> 
> Using qapp as a context manager seems to fix it. 
> Putting everything into a run() function (without "global qapp") and calling
> that also does.
> 
> In other words, if the QApplication is destroyed *before* whatever QtWebEngine
> initializes internally it seems to not segfault.
> 
> That seems the exact opposite of what's recommended here though:
> https://www.riverbankcomputing.com/static/Docs/PyQt5/gotchas.html#crashes-on-exit

FWIW I also can't reproduce the issue with PySide2 5.13.0 (with a simple
s/PyQt5/PySide2/ in the original reproducer).

(Sorry for the follow-up - only occurred to me to try that after I already sent
my original mail)

Florian

-- 
https://www.qutebrowser.org | [email protected] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAl0vS7sACgkQkW6wyP1V
oHJKBg//W669jE6kZQ1UleKGtkTNC3OvHI9Mt7O9QkJFr0NCPC/22dz7+eQ9Yzw/
JaZF+knJ1kr+meNeeRkTp2qJXgKQGPR23s6a4zTpH3M5OKSVOlrk2hgQJk4Z8dwA
2MEj9Z3X9Pj1FOTblmkvXfYmMow+5sC1OgGzG/m0gx7RN17hL/a+6qa9pARVQ4ON
RDViqMhtJHZScsCcjZxdvWMDyxoLsFrFPaxE4fJzwr+9xkC0t3YRA7Ln9OI67NCO
EjF4CsKRctrwmBR1hCBhQ8Kvy8qf725bG3KeF2aTF5yHuHbx/0IRG0UO9Ciy4MDP
iyoNaBl4xfL2kxJBUivKPnTZjrY+62WaU1PwnaildKZAAB8QCgnXTMQ8y1ZiFm8u
efdKGOOVHiokbA7ur13risJ6lkAzdhAicV2m82SCZA5Z5NGPjgF60/HvViURdyRq
vjJwRvvBr7aOzVpsu0fy/QlY+zuCwStbak1WP2GMoPQQbBwuva80Xi4FicMeObKh
BMol0wot0AhMKyjvLsTGOvC+Nx7cKEPV2fpZbICbmUZ0dUp+Md4BthlBZ2wIrdx0
3nKHjSjynWmgZ35Dx4PM82fIyjsT+SseRZhA/DrgglpRMWQ17988QEOjIdJpfqU5
7XoroV24ZuoutZYjsP0gU+MBcIzwjaIvQZeCBy3nr9hlh1blAd4=
=Comw
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.