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

QStyleSheetStyle segfault on exit with exception in request interceptor #8098

Open
The-Compiler opened this issue Feb 9, 2024 · 1 comment
Labels
bug: segfault/crash/hang There's a low-level crash in C++, or a hang/freeze. priority: 2 - low Issues which are currently not very important.

Comments

@The-Compiler
Copy link
Member

Version info:

qutebrowser v3.1.0
Git commit: c12340802 on main (2024-02-02 11:06:04 +0100)
Backend: QtWebEngine 6.6.1, based on Chromium 112.0.5615.213 (from api)
Qt: 6.6.1

Does the bug happen if you start with --temp-basedir?: yes

Description

After Python exception has been shown:

(gdb) bt
#0  0x0000000000000041 in ??? ()
#1  0x00007ffff204249b in QObject::inherits (classname=0x7ffff23b6f55 "QMacStyle", this=<optimized out>, this=<optimized out>, classname=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.h:313
#2  QStyleSheetStyle::getDefaultStyleSheet (this=0x555556b12f20) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle_default.cpp:124
#3  0x00007ffff2015a49 in QStyleSheetStyle::styleRules (this=this@entry=0x555556b12f20, obj=obj@entry=0x555556bacb30) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle.cpp:1681
#4  0x00007ffff2016ba9 in QStyleSheetStyle::renderRule (this=<optimized out>, obj=obj@entry=0x555556bacb30, element=<optimized out>, element@entry=0, state=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle.cpp:1878
#5  0x00007ffff201a021 in QStyleSheetStyle::setGeometry (this=<optimized out>, w=0x555556bacb30) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle.cpp:2615
#6  0x00007ffff201c762 in QStyleSheetStyle::unpolish (w=0x555556bacb30, this=0x555556b12f20) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle.cpp:3054
#7  QStyleSheetStyle::unpolish (this=0x555556b12f20, w=0x555556bacb30) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/styles/qstylesheetstyle.cpp:3042
#8  0x00007ffff1fb0ec8 in QWidgetPrivate::setStyle_helper (this=0x555556aaec40, newStyle=0x0, propagate=true) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:2671
#9  0x00007ffff1fc1b5d in QWidget::setParent (this=this@entry=0x555556bacb30, parent=<optimized out>, parent@entry=0x0, f=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:10808
#10 0x00007ffff1fc21bc in QWidget::setParent (parent=0x0, this=0x555556bacb30) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:10671
#11 0x00007fffef7ef030 in QtWebEngineCore::WebEngineQuickWidget::removeParentBeforeParentDelete (this=0x555556bacb30) at /usr/src/debug/qt6-webengine/qtwebengine-everywhere-src-6.6.1/src/webenginewidgets/api/qwebengineview.cpp:246
#12 0x00007ffff59b9ec9 in QtPrivate::QSlotObjectBase::call (a=0x7fffffff91a0, r=0x555556bacb30, this=0x555556af01a0, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobjectdefs_impl.h:433
#13 doActivate<false> (sender=0x555556a97530, signal_index=0, argv=0x7fffffff91a0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:4021
#14 0x00007ffff59abb43 in QObject::destroyed (this=this@entry=0x555556a97530, _t1=<optimized out>, _t1@entry=0x555556a97530) at /usr/src/debug/qt6-base/build/src/corelib/kernel/moc_qobject.cpp:272
#15 0x00007ffff1fabbbc in QWidget::~QWidget (this=0x555556a97530, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1512
#16 0x00007ffff25be2f7 in sipQWebEngineView::~sipQWebEngineView (this=0x555556a97530, this=<optimized out>) at /usr/src/debug/pyqt6-webengine/PyQt6_WebEngine-6.6.0/build/QtWebEngineWidgets/sipQtWebEngineWidgetsQWebEngineView.cpp:385
#17 sipQWebEngineView::~sipQWebEngineView (this=0x555556a97530, this=<optimized out>) at /usr/src/debug/pyqt6-webengine/PyQt6_WebEngine-6.6.0/build/QtWebEngineWidgets/sipQtWebEngineWidgetsQWebEngineView.cpp:385
#18 0x00007ffff59a587b in QObjectPrivate::deleteChildren (this=this@entry=0x555556abb250) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:2206
#19 0x00007ffff1fabbd1 in QWidget::~QWidget (this=0x555556ad51d0, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1532
#20 0x00007ffff27c7cb7 in sipQSplitter::~sipQSplitter (this=0x555556ad51d0, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQSplitter.cpp:352
#21 sipQSplitter::~sipQSplitter (this=0x555556ad51d0, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQSplitter.cpp:352
#22 0x00007ffff59a587b in QObjectPrivate::deleteChildren (this=this@entry=0x555556af84c0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:2206
#23 0x00007ffff1fabbd1 in QWidget::~QWidget (this=this@entry=0x555556af6c50, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1532
#24 0x00007ffff297d9a7 in sipQWidget::~sipQWidget (this=0x555556af6c50, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQWidget.cpp:369
#25 sipQWidget::~sipQWidget (this=0x555556af6c50, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQWidget.cpp:369
#26 0x00007ffff59a587b in QObjectPrivate::deleteChildren (this=this@entry=0x55555641d310) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:2206
#27 0x00007ffff1fabbd1 in QWidget::~QWidget (this=0x55555646a020, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1532
#28 0x00007ffff21637c1 in QFrame::~QFrame (this=0x55555646a020, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/widgets/qframe.cpp:229
#29 QStackedWidget::~QStackedWidget (this=0x55555646a020, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/widgets/qstackedwidget.cpp:110
#30 QStackedWidget::~QStackedWidget (this=0x55555646a020, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/widgets/qstackedwidget.cpp:110
#31 0x00007ffff59a587b in QObjectPrivate::deleteChildren (this=this@entry=0x555556455f30) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:2206
#32 0x00007ffff1fabbd1 in QWidget::~QWidget (this=0x555556467010, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1532
#33 0x00007ffff2788187 in sipQTabWidget::~sipQTabWidget (this=0x555556467010, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQTabWidget.cpp:341
#34 sipQTabWidget::~sipQTabWidget (this=0x555556467010, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQTabWidget.cpp:341
#35 0x00007ffff59a587b in QObjectPrivate::deleteChildren (this=this@entry=0x555556bdd370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:2206
#36 0x00007ffff1fabbd1 in QWidget::~QWidget (this=this@entry=0x555556bbc930, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qwidget.cpp:1532
#37 0x00007ffff297d9a7 in sipQWidget::~sipQWidget (this=0x555556bbc930, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQWidget.cpp:369
#38 sipQWidget::~sipQWidget (this=0x555556bbc930, this=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQWidget.cpp:369
#39 0x00007ffff5ffdb97 in cleanup_qobject (sw=0x7fffd45e7e20, closure=<optimized out>) at ../../qpy/QtCore/qpycore_public_api.cpp:68
#40 0x00007ffff6171350 in sip_api_visit_wrappers (visitor=0x7ffff5ffdae0 <cleanup_qobject(sipSimpleWrapper*, void*)>, closure=0x555555cd0070) at /usr/src/debug/python-pyqt6-sip/PyQt6_sip-13.6.0/sip_core.c:11861
#41 0x00007ffff5ffda4f in pyqt6_cleanup_qobjects () at ../../qpy/QtCore/qpycore_public_api.cpp:80
#42 cleanup_on_exit () at ../../qpy/QtCore/qpycore_init.cpp:41
#43 0x00007ffff79de349 in cfunction_vectorcall_NOARGS (func=<built-in function _qtcore_cleanup>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ./Include/cpython/methodobject.h:52
#44 0x00007ffff7ac93b8 in atexit_callfuncs (state=0x7ffff7d6fdc8 <_PyRuntime+62472>) at ./Modules/atexitmodule.c:98
#45 0x00007ffff7ab8e2e in _PyAtExit_Call (interp=<optimized out>) at ./Modules/atexitmodule.c:118
#46 Py_FinalizeEx () at Python/pylifecycle.c:1779
#47 0x00007ffff793aad5 in Py_Exit (sts=2) at Python/pylifecycle.c:2940
#48 0x00007ffff7acc33b in handle_system_exit () at Python/pythonrun.c:771
#49 0x00007ffff7935f5f in _PyErr_PrintEx (tstate=0x7ffff7d89378 <_PyRuntime+166328>, set_sys_last_vars=<optimized out>) at Python/pythonrun.c:828
#50 0x00007ffff5ffdc5f in pyqt6_err_print () at ../../qpy/QtCore/qpycore_public_api.cpp:112
#51 0x00007ffff6170102 in sip_api_call_error_handler (sipGILState=PyGILState_UNLOCKED, py_self=0x7fffd45e6dd0, error_handler=0x7ffff5eaa830 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>)
    at /usr/src/debug/python-pyqt6-sip/PyQt6_sip-13.6.0/sip_core.c:2477
#52 sip_api_call_procedure_method
    (gil_state=PyGILState_UNLOCKED, error_handler=0x7ffff5eaa830 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>, py_self=0x7fffd45e6dd0, method=<unknown at remote 0x7fffd468f240>, fmt=<optimized out>)
    at /usr/src/debug/python-pyqt6-sip/PyQt6_sip-13.6.0/sip_core.c:2047
#53 0x00007fffd51ef5ae in sipVH_QtWebEngineCore_39 (a0=..., sipMethod=<optimized out>, sipPySelf=<optimized out>, sipErrorHandler=<optimized out>, sipGILState=<optimized out>)
    at /usr/src/debug/pyqt6-webengine/PyQt6_WebEngine-6.6.0/build/QtWebEngineCore/sipQtWebEngineCorecmodule.cpp:932
#54 sipQWebEngineUrlRequestInterceptor::interceptRequest (this=0x5555561e9430, a0=...) at /usr/src/debug/pyqt6-webengine/PyQt6_WebEngine-6.6.0/build/QtWebEngineCore/sipQtWebEngineCoreQWebEngineUrlRequestInterceptor.cpp:175
#55 0x00007fffe5fad1aa in QtWebEngineCore::InterceptedRequest::InterceptOnUIThread () at /usr/src/debug/qt6-webengine/qtwebengine-everywhere-src-6.6.1/src/core/net/proxying_url_loader_factory_qt.cpp:347
#56 0x00007fffe5fb1aa3 in QtWebEngineCore::InterceptedRequest::Restart () at /usr/src/debug/qt6-webengine/qtwebengine-everywhere-src-6.6.1/src/core/net/proxying_url_loader_factory_qt.cpp:339
#57 0x00007fffe5fb2936 in QtWebEngineCore::ProxyingURLLoaderFactoryQt::CreateLoaderAndStart () at /usr/src/debug/qt6-webengine/qtwebengine-everywhere-src-6.6.1/src/core/net/proxying_url_loader_factory_qt.cpp:579
#58 0x00007fffe674e7cc in network::mojom::URLLoaderFactoryStubDispatch::Accept () at gen/services/network/public/mojom/url_loader_factory.mojom.cc:306
#59 0x00007fffea3279c3 in mojo::InterfaceEndpointClient::HandleValidatedMessage () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:1000
#60 0x00007fffea328a27 in mojo::MessageDispatcher::Accept () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/message_dispatcher.cc:48
#61 0x00007fffea3273ee in mojo::InterfaceEndpointClient::HandleIncomingMessage () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:694
#62 0x00007fffea32bd58 in mojo::internal::MultiplexRouter::ProcessIncomingMessage () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc:1096
#63 0x00007fffea32f462 in mojo::internal::MultiplexRouter::Accept () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/multiplex_router.cc:710
#64 0x00007fffea328a7e in mojo::MessageDispatcher::Accept () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/message_dispatcher.cc:43
#65 0x00007fffea321a54 in mojo::Connector::DispatchMessage () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/connector.cc:550
#66 0x00007fffea322296 in mojo::Connector::ReadAllAvailableMessages () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/bindings/lib/connector.cc:607
#67 0x00007fffe816476e in base::RepeatingCallback<void (unsigned int)>::Run(unsigned int) const & () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/functional/callback.h:333
#68 mojo::SimpleWatcher::DiscardReadyState(base::RepeatingCallback<void (unsigned int)> const&, unsigned int, mojo::HandleSignalsState const&) ()
    at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/system/simple_watcher.h:192
#69 0x00007fffea34685d in base::RepeatingCallback<void (unsigned int, mojo::HandleSignalsState const&)>::Run(unsigned int, mojo::HandleSignalsState const&) const & ()
    at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/functional/callback.h:333
#70 mojo::SimpleWatcher::OnHandleReady () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/mojo/public/cpp/system/simple_watcher.cc:278
#71 0x00007fffe9ae7ebe in base::OnceCallback<void ()>::Run() && () at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/functional/callback.h:152
#72 base::TaskAnnotator::RunTaskImpl () at ./../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/task/common/task_annotator.cc:162
#73 0x00007fffe9b024a9 in RunTask<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*)::<lambda(perfetto::EventContext&)> > ()
    at ../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/task/common/task_annotator.h:88
#74 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl ()
    at ./../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:490
#75 0x00007fffe9b02ef6 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork ()
    at ./../../../../../qtwebengine-everywhere-src-6.6.1/src/3rdparty/chromium/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:340
#76 0x00007fffe5f50ffd in QtWebEngineCore::MessagePumpForUIQt::handleScheduledWork () at /usr/src/debug/qt6-webengine/qtwebengine-everywhere-src-6.6.1/src/core/browser_main_parts_qt.cpp:201
#77 0x00007ffff59a53b6 in QObject::event (this=0x5555562ac1d0, e=0x555556af0090) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qobject.cpp:1414
#78 0x00007ffff1f7319b in QApplicationPrivate::notify_helper (this=this@entry=0x7fffffffbb20, receiver=0x5555562ac1d0, receiver@entry=0x2e7b4, e=e@entry=0x555556af0090)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qapplication.cpp:3296
#79 0x00007ffff1f74ed9 in QApplication::notify (this=this@entry=0x555555cd0070, receiver=0x2e7b4, receiver@entry=0x5555562ac1d0, e=e@entry=0x555556af0090)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qapplication.cpp:3058
#80 0x00007ffff295e467 in sipQApplication::notify (this=0x555555cd0070, a0=0x5555562ac1d0, a1=0x555556af0090) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQApplication.cpp:246
--Type <RET> for more, q to quit, c to continue without paging--
#81 0x00007ffff5962a78 in QCoreApplication::notifyInternal2 (receiver=0x5555562ac1d0, event=event@entry=0x555556af0090) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qcoreapplication.cpp:1121
#82 0x00007ffff5962dfb in QCoreApplication::sendEvent (event=0x555556af0090, receiver=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qcoreapplication.cpp:1539
#83 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x5555557341e0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qcoreapplication.cpp:1901
#84 0x00007ffff5b9ead4 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qcoreapplication.cpp:1760
#85 postEventSourceDispatch (s=0x555555ea1150) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qeventdispatcher_glib.cpp:243
#86 0x00007ffff6738f69 in g_main_dispatch (context=0x7fffcc000fa0) at ../glib/glib/gmain.c:3476
#87 0x00007ffff67973a7 in g_main_context_dispatch_unlocked (context=0x7fffcc000fa0) at ../glib/glib/gmain.c:4284
#88 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fffcc000fa0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4349
#89 0x00007ffff6737162 in g_main_context_iteration (context=0x7fffcc000fa0, may_block=1) at ../glib/glib/gmain.c:4414
#90 0x00007ffff5b9d074 in QEventDispatcherGlib::processEvents (this=0x555555eb0d40, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#91 0x00007ffff596cf5e in QEventLoop::processEvents (flags=..., this=0x7fffffffc030) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qeventloop.cpp:100
#92 QEventLoop::exec (this=0x7fffffffc030, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/kernel/qeventloop.cpp:182
#93 0x00007ffff5965518 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/corelib/global/qflags.h:74
#94 0x00007ffff1f6fd1a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.1/src/widgets/kernel/qapplication.cpp:2574
#95 0x00007ffff295c12e in meth_QApplication_exec (sipSelf=<optimized out>, sipArgs=<optimized out>) at /usr/src/debug/pyqt6/PyQt6-6.6.1/build/QtWidgets/sipQtWidgetsQApplication.cpp:1286
#96 0x00007ffff79fb308 in cfunction_call (func=<built-in method exec of Application object at remote 0x7fffd48cecb0>, args=<optimized out>, kwargs=<optimized out>) at Objects/methodobject.c:553
#97 0x00007ffff79da8ec in _PyObject_MakeTpCall (tstate=0x7ffff7d89378 <_PyRuntime+166328>, callable=<built-in method exec of Application object at remote 0x7fffd48cecb0>, args=<optimized out>, nargs=0, keywords=0x0) at Objects/call.c:214
#98 0x00007ffff79e4c23 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:4760
#99 0x00007ffff7a9c484 in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7f7f1b8, tstate=0x7ffff7d89378 <_PyRuntime+166328>) at ./Include/internal/pycore_ceval.h:73
#100 _PyEval_Vector
    (tstate=tstate@entry=0x7ffff7d89378 <_PyRuntime+166328>, func=func@entry=0x7ffff71d1f80, locals=locals@entry={'__name__': '__main__', '__doc__': 'Simple launcher for qutebrowser.', '__package__': 'qutebrowser', '__loader__': <SourceFileLoader(name='qutebrowser.__main__', path='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py') at remote 0x7ffff70b1650>, '__spec__': <ModuleSpec(name='qutebrowser.__main__', loader=<...>, origin='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', loader_state=None, submodule_search_locations=None, _uninitialized_submodules=[], _set_fileattr=True, _cached='/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc') at remote 0x7ffff70b1690>, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff7188a90>, '__file__': '/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', '__cached__': '/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc', 'sys': <module at remote 0x7ffff717aca0>, 'qutebrowser': <module at remote 0x7ffff70a2390>}, args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at Python/ceval.c:6425
#101 0x00007ffff7a9be6c in PyEval_EvalCode
    (co=<code at remote 0x7ffff71c8880>, globals=<optimized out>, locals={'__name__': '__main__', '__doc__': 'Simple launcher for qutebrowser.', '__package__': 'qutebrowser', '__loader__': <SourceFileLoader(name='qutebrowser.__main__', path='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py') at remote 0x7ffff70b1650>, '__spec__': <ModuleSpec(name='qutebrowser.__main__', loader=<...>, origin='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', loader_state=None, submodule_search_locations=None, _uninitialized_submodules=[], _set_fileattr=True, _cached='/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc') at remote 0x7ffff70b1690>, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff7188a90>, '__file__': '/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', '__cached__': '/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc', 'sys': <module at remote 0x7ffff717aca0>, 'qutebrowser': <module at remote 0x7ffff70a2390>}) at Python/ceval.c:1140
#102 0x00007ffff7ab2c42 in builtin_exec_impl
    (module=<optimized out>, closure=<optimized out>, locals={'__name__': '__main__', '__doc__': 'Simple launcher for qutebrowser.', '__package__': 'qutebrowser', '__loader__': <SourceFileLoader(name='qutebrowser.__main__', path='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py') at remote 0x7ffff70b1650>, '__spec__': <ModuleSpec(name='qutebrowser.__main__', loader=<...>, origin='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', loader_state=None, submodule_search_locations=None, _uninitialized_submodules=[], _set_fileattr=True, _cached='/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc') at remote 0x7ffff70b1690>, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff7188a90>, '__file__': '/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', '__cached__': '/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc', 'sys': <module at remote 0x7ffff717aca0>, 'qutebrowser': <module at remote 0x7ffff70a2390>}, globals={'__name__': '__main__', '__doc__': 'Simple launcher for qutebrowser.', '__package__': 'qutebrowser', '__loader__': <SourceFileLoader(name='qutebrowser.__main__', path='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py') at remote 0x7ffff70b1650>, '__spec__': <ModuleSpec(name='qutebrowser.__main__', loader=<...>, origin='/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', loader_state=None, submodule_search_locations=None, _uninitialized_submodules=[], _set_fileattr=True, _cached='/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc') at remote 0x7ffff70b1690>, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff7188a90>, '__file__': '/home/florian/proj/qutebrowser/git/qutebrowser/__main__.py', '__cached__': '/home/florian/proj/qutebrowser/git/qutebrowser/__pycache__/__main__.cpython-311.pyc', 'sys': <module at remote 0x7ffff717aca0>, 'qutebrowser': <module at remote 0x7ffff70a2390>}, source=<code at remote 0x7ffff71c8880>) at Python/bltinmodule.c:1077
#103 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/clinic/bltinmodule.c.h:465
#104 0x00007ffff79f383a in cfunction_vectorcall_FASTCALL_KEYWORDS (func=<built-in method exec of module object at remote 0x7ffff7188a90>, args=0x7ffff7f7f180, nargsf=<optimized out>, kwnames=0x0) at ./Include/cpython/methodobject.h:52
#105 0x00007ffff79f2987 in _PyObject_VectorcallTstate
    (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>, callable=<built-in method exec of module object at remote 0x7ffff7188a90>, tstate=0x7ffff7d89378 <_PyRuntime+166328>) at ./Include/internal/pycore_call.h:92
#106 PyObject_Vectorcall (callable=<built-in method exec of module object at remote 0x7ffff7188a90>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:299
#107 0x00007ffff79e4c23 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:4760
#108 0x00007ffff7a0bb90 in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7f7f020, tstate=0x7ffff7d89378 <_PyRuntime+166328>) at ./Include/internal/pycore_ceval.h:73
#109 _PyEval_Vector (kwnames=<optimized out>, argcount=2, args=0x7ffff7050118, locals=0x0, func=0x7ffff70ad440, tstate=0x7ffff7d89378 <_PyRuntime+166328>) at Python/ceval.c:6425
#110 _PyFunction_Vectorcall (func=<function at remote 0x7ffff70ad440>, stack=0x7ffff7050118, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:393
#111 0x00007ffff7ac5757 in pymain_run_module (modname=<optimized out>, set_argv0=set_argv0@entry=1) at Modules/main.c:300
#112 0x00007ffff7ac5045 in pymain_run_python (exitcode=0x7fffffffc6b0) at Modules/main.c:595
#113 Py_RunMain () at Modules/main.c:680
#114 0x00007ffff7a8e79b in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:734
#115 0x00007ffff7645cd0 in ??? () at /usr/lib/libc.so.6
#116 0x00007ffff7645d8a in __libc_start_main () at /usr/lib/libc.so.6
#117 0x0000555555555045 in _start ()

How to reproduce

#!/bin/bash --

tmpdir=$(mktemp -d)
trap 'rm -rf -- "$tmpdir"' EXIT

cat > "$tmpdir"/config.py <<!
import qutebrowser.api.interceptor

def rewrite(request: qutebrowser.api.interceptor.Request):
    url = request.request_url.host()
    path = request.request_url.path()

    if url == 'reddit.com' or url == 'www.reddit.com':
        request.request_url.setHost('https://eu.safereddit.com')

        if url != request.request_url.toString():
            request.redirect(request.request_url)

qutebrowser.api.interceptor.register(rewrite)
!

set -- --no-err-windows https://reddit.com

qutebrowser -B "$tmpdir" -C "$tmpdir"/config.py "$@"

Thanks to @Earnestly; also see #5385

@The-Compiler The-Compiler added priority: 2 - low Issues which are currently not very important. bug: segfault/crash/hang There's a low-level crash in C++, or a hang/freeze. labels Feb 9, 2024
@toofar
Copy link
Member

toofar commented Feb 9, 2024

This looks like the same stack trace as the second one here: #5187

My stack trace (click to show)
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007f278348715f in __pthread_kill_internal (signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x00007f2783439472 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3  <signal handler called>
#4  0x0000052bff589c40 in ?? ()
#5  0x00007f277de5468e in QStyleSheetStyle::getDefaultStyleSheet() const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#6  0x00007f277de21e11 in QStyleSheetStyle::styleRules(QObject const*) const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#7  0x00007f277de29af0 in QStyleSheetStyle::renderRule(QObject const*, int, unsigned long long) const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#8  0x00007f277de2c9c5 in QStyleSheetStyle::setGeometry(QWidget*) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#9  0x00007f277de2d28e in QStyleSheetStyle::unpolish(QWidget*) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#10 0x00007f277ddc9042 in QWidgetPrivate::setStyle_helper(QStyle*, bool) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#11 0x00007f277ddd81e3 in QWidget::setParent(QWidget*, QFlags<Qt::WindowType>) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#12 0x00007f277e393b3b in QtWebEngineCore::WebEngineQuickWidget::removeParentBeforeParentDelete() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineWidgets.so.6
#13 0x00007f27815bc4c3 in void doActivate<false>(QObject*, int, void**) () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#14 0x00007f27815b3c5f in QObject::destroyed(QObject*) () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#15 0x00007f277ddd334b in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#16 0x00007f278126c7d9 in sipQWebEngineView::~sipQWebEngineView() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineWidgets.abi3.so
#17 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#18 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#19 0x00007f277e5d3b79 in sipQSplitter::~sipQSplitter() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#20 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#21 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#22 0x00007f277e74f309 in sipQWidget::~sipQWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#23 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#24 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#25 0x00007f277df6b409 in QStackedWidget::~QStackedWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#26 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#27 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#28 0x00007f277e599a39 in sipQTabWidget::~sipQTabWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#29 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#30 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#31 0x00007f277e74f309 in sipQWidget::~sipQWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#32 0x00007f2781dfd07f in cleanup_qobject(_sipSimpleWrapper*, void*) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#33 0x00007f2782087bb9 in sip_api_visit_wrappers (visitor=0x7f2781dfcfc0 <cleanup_qobject(_sipSimpleWrapper*, void*)>, closure=0x52bfe4d9fe0) at sip_core.c:11861
#34 0x00007f2781dfc9eb in cleanup_on_exit(_object*, _object*) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#35 0x000000000051ca94 in cfunction_vectorcall_NOARGS (func=<built-in function _qtcore_cleanup>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ../Objects/methodobject.c:486
#36 0x0000000000631058 in atexit_callfuncs (state=0xa5f468 <_PyRuntime+62472>) at ../Modules/atexitmodule.c:98
#37 0x000000000061dba7 in _PyAtExit_Call (interp=<optimized out>) at ../Modules/atexitmodule.c:118
#38 Py_FinalizeEx () at ../Python/pylifecycle.c:1779
#39 0x0000000000646b8c in Py_Exit (sts=2) at ../Python/pylifecycle.c:2940
#40 0x000000000063319f in handle_system_exit () at ../Python/pythonrun.c:771
#41 0x000000000046344e in _PyErr_PrintEx.part.0.lto_priv.0 (tstate=0xa78a18 <_PyRuntime+166328>, set_sys_last_vars=<optimized out>) at ../Python/pythonrun.c:828
#42 0x00007f2781dfd141 in pyqt6_err_print() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#43 0x00007f27820918ee in sip_api_call_error_handler (sipGILState=PyGILState_UNLOCKED, py_self=0x7f276eca6950, error_handler=0x7f2781cb5f40 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>) at sip_core.c:2477
#44 sip_api_call_procedure_method (gil_state=PyGILState_UNLOCKED, error_handler=0x7f2781cb5f40 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>, py_self=0x7f276eca6950, method=<unknown at remote 0x7f276ed3c480>, fmt=<optimized out>)
    at sip_core.c:2047
#45 0x00007f276f8e362d in sipVH_QtWebEngineCore_39(PyGILState_STATE, void (*)(_sipSimpleWrapper*, PyGILState_STATE), _sipSimpleWrapper*, _object*, QWebEngineUrlRequestInfo&) ()
   from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineCore.abi3.so
#46 0x00007f276f8f31d1 in sipQWebEngineUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo&) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineCore.abi3.so
#47 0x00007f27713c41c6 in QtWebEngineCore::InterceptedRequest::InterceptOnUIThread() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#48 0x00007f27713d0b14 in QtWebEngineCore::InterceptedRequest::Restart() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#49 0x00007f27713d19d2 in QtWebEngineCore::ProxyingURLLoaderFactoryQt::CreateLoaderAndStart(mojo::PendingReceiver<network::mojom::URLLoader>, int, unsigned int, network::ResourceRequest const&, mojo::PendingRemote<network::mojom::URLLoaderClient>, net::MutableNetworkTrafficAnnotationTag const&) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#50 0x00007f2771bd1a34 in network::mojom::URLLoaderFactoryStubDispatch::Accept(network::mojom::URLLoaderFactory*, mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#51 0x00007f2775e96993 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#52 0x00007f2775e979c7 in mojo::MessageDispatcher::Accept(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#53 0x00007f2775e9638e in mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#54 0x00007f2775e9acf8 in mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) ()
   from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6

I don't have debug symbols here but we can see that in QtWebEngineCore::WebEngineQuickWidget::removeParentBeforeParentDelete() parent is set to nullptr. I think QWidget calls into the style stuff with d->inheritStyle(). And then QStyleSheetStyle::getDefaultStyleSheet() calls into baseStyle()->inherits("QMacStyle") (That's QWidget::inherits(ClassName)). Presumably whatever is stored in baseStyle() in invalid at that point, not sure what is set there but I guess it is referenced from the parent widget.

The object heirachy from gammaray is:

image

From some shotgun experimentation I think that the QQuickWidget here is inheriting from our MainWindow stylesheet, eg if I remove that line I get no core file left behind.

So looks like something in the object heirarchy is invalid at that point, which isn't particularly surprising when we are being called from a chain of destructors! Is this normal? On normal shutdowns we quit in a nice orderly fashion to make sure everything gets shut down in the right order. When we are crashing we just call QApplication.closeAllWindows() and let Qt close everything in whatever order it likes. Ideally it would do that child first but I guess that is up to each widget to implement it's destructor that way. Actually our quitter does call QApplication.closeAllWindows() via a signal, it does call a bunch of other stuff too. 🤔

So what can we do to work around this? Some ideas I can come up with:

  1. shut down using our quitter
    • maybe? I think doing more work during a crash situation could lead to more issues. But this closeAllWindows() statement dates back to the very early days of qutebrowser and pre-dates the quitter. So maybe worth a try?
  2. call setStyleSheet(None) on something (MainWindow?) when shutting down
    • I don't think we can override c++ destructors to hook into them? And there doesn't look like any other convenient hook points in that stack trace
    • I tried using obj.disconnect() in the StyleSheetObserver but it seems that comes too late to help
    • do it in the exceptions handler that we already have to handle printing version information and crash dialogs
  3. set Qt::WA_SetStyle=false on the QQuick widget?
    • hmm, doesn't seem to help. Maybe it's too late? Maybe I'm wrong about the object at the bottom of the call stack here?
  4. finagle our widget hierarchy in some way so that Qts naive way of shutting stuff down just works?
    • idk, my brain is too small for that

Anyway, (2) is the only one I got working. Removing the stylsheets from MainWindow in the exception handler seems to prevent a core file from being created. It does mean we are doing more work in a situation where we are crashing, which is not great. But apart from the setStyleSheet() itself (which to be fair could be doing anything) it's just accessing a module level dict:

diff --git i/qutebrowser/misc/crashsignal.py w/qutebrowser/misc/crashsignal.py
index c69dcbe29094..d7c81da58ed7 100644
--- i/qutebrowser/misc/crashsignal.py
+++ w/qutebrowser/misc/crashsignal.py
@@ -273,6 +273,11 @@ class CrashHandler(QObject):

         self.is_crashing = True

+        # Remove stylesheets that get inherited by children so they don't try to
+        # access them when everything is shutting down. See #8098
+        for window in objreg.window_registry.values():
+            window.setStyleSheet(None)
+
         self._app.closeAllWindows()
         if self._args.no_err_windows:
             crashdialog.dump_exception_info(exc, info.pages, info.cmd_history,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: segfault/crash/hang There's a low-level crash in C++, or a hang/freeze. priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

2 participants