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

[FreeBSD] Segmentation fault on startup #1674

Open
herrhotzenplotz opened this issue Dec 22, 2024 · 4 comments
Open

[FreeBSD] Segmentation fault on startup #1674

herrhotzenplotz opened this issue Dec 22, 2024 · 4 comments
Labels
frontend Contour Terminal Emulator (GUI frontend) platform: FreeBSD FreeBSD platform specific

Comments

@herrhotzenplotz
Copy link
Contributor

Building contour from master has been resulting in segfaulting binaries for a while now:

This is roughly the same stacktrace in the few commits that are compilabile in the git history, segfaults happens somewhere in GStreamer (sic!) where a nullptr is dereferenced:

triton $ idprio 0 ninja -C build
ninja: Entering directory `build'
[0/1] Re-running CMake...
-- [Version] Git branch: master
-- [Version] Git SHA: 46f74e9d
-- [Version] version source: git & /home/nsonack/src/contour/metainfo.xml
-- [Version] version triple: 0.5.2
-- [Version] version string: 0.5.2-master-46f74e9d
-- [ccache] Enabled: /usr/local/bin/ccache
-- [clang-tidy] Disabled.
-- addr2line: /usr/bin/addr2line
-- No sanitizer enabled.
-- Embedding 3rdparty libraries: /home/nsonack/src/contour/_deps/sources
-- ==============================================================================
--     Contour ThirdParties: 
-- [clang-tidy] Disabled.
-- Performing Test fdiagnostics-color=always
-- Performing Test fdiagnostics-color=always - Success
-- Adding compiler flag: -fdiagnostics-color=always.
-- Enabling pedantic compiler options: no
-- [code coverage] Disabled.
-- libunicode library build mode: STATIC
-- ------------------------------------------------------------------------------
--     libunicode (version 0.6.0)
-- ------------------------------------------------------------------------------
-- Build type:                  RelWithDebInfo
-- Build mode:                  static
-- Build unit tests:            OFF
-- Build benchmark:             OFF
-- Build tools:                 OFF
-- Enable tablegen fast build:  OFF
-- Using ccache:                /usr/local/bin/ccache
-- SIMD support:                intrinsics
-- Using UCD directory:         /home/nsonack/src/contour/_deps/sources/libunicode-817cb5900acdf6f60e2344a4c8f1f39262878a4b/_ucd/ucd-16.0.0
-- Enable clang-tidy:           OFF ()
-- ------------------------------------------------------------------------------
-- ==============================================================================
--     ThirdParties
-- ------------------------------------------------------------------------------
-- ------------------------------------------------------------------------------
-- base dir: /home/nsonack/src/contour/build/_deps/sources/boxed-cpp-1.4.3/3rdparty
-- dnld dir: /home/nsonack/src/contour/build/_deps/sources/boxed-cpp-1.4.3/_downloads
-- [clang-tidy] Disabled.
-- Adding compiler flag: -fdiagnostics-color=always.
-- Enabling pedantic compiler options: no
-- [boxed-cpp] Compile unit tests: OFF
-- base dir: /home/nsonack/src/contour/build/_deps/sources/reflection-cpp-02484cd9ec16d7efc252ab8fd1f85d7264192418/3rdparty
-- dnld dir: /home/nsonack/src/contour/build/_deps/sources/boxed-cpp-1.4.3/_downloads
-- [clang-tidy] Disabled.
-- Adding compiler flag: -fdiagnostics-color=always.
-- Enabling pedantic compiler options: no
-- [reflection-cpp] Compile unit tests: OFF
-- Adding compiler flag: -fdiagnostics-color=always.
-- Enabling pedantic compiler options: no
-- [crispy-core] Skipping compile definition: HAVE_BACKTRACE
-- [crispy-core] Skipping compile definition: HAVE_BACKTRACE_SYMBOLS
-- [crispy-core] Adding compile definition: HAVE_CXXABI_H
-- [crispy-core] Adding compile definition: HAVE_DLADDR
-- [crispy-core] Adding compile definition: HAVE_DLFCN_H
-- [crispy-core] Adding compile definition: HAVE_DLSYM
-- [crispy-core] Adding compile definition: HAVE_EXECINFO_H
-- [crispy-core] Adding compile definition: HAVE_SYS_SELECT_H
-- [crispy-core] Adding compile definition: HAVE_UNWIND_H
-- [crispy] Compile unit tests: OFF
-- [text_shaper] Librarires: unicode::unicode;boxed-cpp::boxed-cpp;range-v3::range-v3;Microsoft.GSL::GSL;Freetype::Freetype;PkgConfig::harfbuzz;Fontconfig::Fontconfig
-- [vtpty] Builtin-SSH support enabled
-- [vtbackend] Compile unit tests: OFF
-- [vtbackend] Enable VT sequence tracing: ON
-- [vtbackend] Enable passive render buffer update: OFF
-- [vtbackend] Build bench-headless: OFF
-- [vtbackend] Build documentation tool: OFF
-- [vtrasterizer] Compile unit tests: 
-- Qt components: Core;Gui;Qml;Quick;QuickControls2;Network;Multimedia;Widgets;OpenGL;OpenGLWidgets;Core5Compat
-- Executable tic found (/usr/bin/tic).
-- ==============================================================================
--     Contour ThirdParties
-- ------------------------------------------------------------------------------
-- Catch2              
-- GSL                 system package
-- freetype            system package
-- harfbuzz            system package
-- range-v3            system package
-- yaml-cpp            system package
-- termbench-pro       (bench-headless disabled)
-- reflection-cpp      embedded
-- libunicode          embedded
-- boxed-cpp           embedded
-- ------------------------------------------------------------------------------
-- ==============================================================================
--     Contour (0.5.2-master-46f74e9d)
-- ------------------------------------------------------------------------------
-- System:                                             amd64 (FreeBSD)
-- Build type:                                         RelWithDebInfo
-- C++ standard:                                       C++20 (Clang)
-- Using ccache:                                       /usr/local/bin/ccache
-- Build with sanitizer:                               OFF
-- Build unit tests:                                   OFF
-- Enable with code coverage:                          OFF
-- Build contour frontend GUI:                         ON
-- Build contour using Qt:                             6 (6.7.3)
-- Build contour using mimalloc:                       OFF
-- Clang Tidy:                                         OFF
-- |> Enable performance metrics:                      OFF
-- ------------------------------------------------------------------------------
-- Configuring done (0.5s)
-- Generating done (0.1s)
-- Build files have been written to: /home/nsonack/src/contour/build
[91/91] Linking CXX executable src/contour/contour
triton $ 
triton $ 
triton $ 
triton $ build/src/contour/contour
Segmentation fault (core dumped)
triton $ 
triton $ 
triton $ lldb -- build/src/contour/contour
(lldb) target create "build/src/contour/contour"
Current executable set to '/home/nsonack/src/contour/build/src/contour/contour' (x86_64).
(lldb) r
Process 41373 launched: '/home/nsonack/src/contour/build/src/contour/contour' (x86_64)
Process 41373 stopped
* thread #1, name = 'contour', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x0)
    frame #0: 0x0000000895555bc7 libgstreamermediaplugin.so`___lldb_unnamed_symbol1651 + 7
libgstreamermediaplugin.so`___lldb_unnamed_symbol1651:
->  0x895555bc7 <+7>:  movq   (%rax), %rax
    0x895555bca <+10>: movq   (%rax), %rdi
    0x895555bcd <+13>: callq  0x895595e10    ; symbol stub for: g_type_name
    0x895555bd2 <+18>: movq   %rax, %rdx
(lldb) bt
* thread #1, name = 'contour', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x0)
  * frame #0: 0x0000000895555bc7 libgstreamermediaplugin.so`___lldb_unnamed_symbol1651 + 7
    frame #1: 0x000000089557eb01 libgstreamermediaplugin.so`___lldb_unnamed_symbol2283 + 401
    frame #2: 0x0000000823c7b6e9 libQt6Multimedia.so.6`QAudioOutput::QAudioOutput(QAudioDevice const&, QObject*) + 185
    frame #3: 0x0000000823c7b5fe libQt6Multimedia.so.6`QAudioOutput::QAudioOutput(QObject*) + 62
    frame #4: 0x000000087aa41120 libQt6MultimediaQuick.so.6`___lldb_unnamed_symbol1143 + 16
    frame #5: 0x00000008290e865f libQt6Qml.so.6`QQmlType::create(void**, unsigned long) const + 79
    frame #6: 0x00000008290e8753 libQt6Qml.so.6`QQmlType::createWithQQmlData() const + 51
    frame #7: 0x0000000829097042 libQt6Qml.so.6`QQmlObjectCreator::createInstance(int, QObject*, bool) + 1474
    frame #8: 0x000000082909b44e libQt6Qml.so.6`QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) + 2270
    frame #9: 0x000000082909a56e libQt6Qml.so.6`QQmlObjectCreator::setupBindings(QFlags<QQmlObjectCreator::BindingMode>) + 1278
    frame #10: 0x000000082909def2 libQt6Qml.so.6`QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*, QV4::CompiledData::Binding const*) + 4530
    frame #11: 0x0000000829097b84 libQt6Qml.so.6`QQmlObjectCreator::createInstance(int, QObject*, bool) + 4356
    frame #12: 0x00000008290965f1 libQt6Qml.so.6`QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*, int) + 529
    frame #13: 0x00000008290971ba libQt6Qml.so.6`QQmlObjectCreator::createInstance(int, QObject*, bool) + 1850
    frame #14: 0x000000082909b44e libQt6Qml.so.6`QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) + 2270
    frame #15: 0x000000082909a56e libQt6Qml.so.6`QQmlObjectCreator::setupBindings(QFlags<QQmlObjectCreator::BindingMode>) + 1278
    frame #16: 0x000000082909def2 libQt6Qml.so.6`QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*, QV4::CompiledData::Binding const*) + 4530
    frame #17: 0x0000000829097b84 libQt6Qml.so.6`QQmlObjectCreator::createInstance(int, QObject*, bool) + 4356
    frame #18: 0x00000008290965f1 libQt6Qml.so.6`QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*, int) + 529
    frame #19: 0x00000008290294db libQt6Qml.so.6`QQmlComponentPrivate::beginCreate(QQmlRefPointer<QQmlContextData>) + 1851
    frame #20: 0x0000000829028d5c libQt6Qml.so.6`QQmlComponent::beginCreate(QQmlContext*) + 60
    frame #21: 0x000000082902829e libQt6Qml.so.6`QQmlComponentPrivate::createWithProperties(QObject*, QMap<QString, QVariant> const&, QQmlContext*, QQmlComponentPrivate::CreateBehavior) + 94
    frame #22: 0x0000000829028224 libQt6Qml.so.6`QQmlComponent::create(QQmlContext*) + 52
    frame #23: 0x000000082900c0ae libQt6Qml.so.6`QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) + 126
    frame #24: 0x000000082900bafb libQt6Qml.so.6`QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool) + 699
    frame #25: 0x000000082900c5e5 libQt6Qml.so.6`QQmlApplicationEngine::load(QUrl const&) + 53
    frame #26: 0x00000000005a7674 contour`contour::ContourGuiApp::terminalGuiAction() [inlined] contour::ContourGuiApp::newWindow(this=0x00000008210e7590) at ContourGuiApp.cpp:563:17
    frame #27: 0x00000000005a7646 contour`contour::ContourGuiApp::terminalGuiAction(this=0x00000008210e7590) at ContourGuiApp.cpp:464:5
    frame #28: 0x00000000005fffb9 contour`crispy::app::run(int, char const**) [inlined] std::__1::__function::__value_func<int ()>::operator()[abi:se180100](this=0x00000779e1891740) const at function.h:428:12
    frame #29: 0x00000000005fffaa contour`crispy::app::run(int, char const**) [inlined] std::__1::function<int ()>::operator()(this= Function = contour::ContourGuiApp::terminalGuiAction() ) const at function.h:981:10
    frame #30: 0x00000000005fffaa contour`crispy::app::run(this=0x00000008210e7590, argc=<unavailable>, argv=<unavailable>) at App.cpp:228:24
    frame #31: 0x000000000051a23f contour`main(argc=1, argv=0x00000008210e7be8) at main.cpp:136:16
    frame #32: 0x0000000833aa4c3a libc.so.7`__libc_start1(argc=1, argv=0x00000008210e7be8, env=0x00000008210e7bf8, cleanup=<unavailable>, mainX=(contour`main at main.cpp:123)) at libc_start1.c:157:7
    frame #33: 0x0000000000500d70 contour`_start at crt1_s.S:83
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] 
triton $ 
triton $ 
triton $ 
triton $ git log -n1 --pretty=reference @ | cat
46f74e9d (Merge pull request #1658 from contour-terminal/improvement/search, 2024-12-17)
triton $ 

Unfortunately I cannot bisect this because most commits are not compilable due to the change of libfmt => std::format.

@christianparpart
Copy link
Member

Marry Christmas @herrhotzenplotz!

I'm sorry to hear that. Looking at the stacktrace, I feel like there's not much caused by our own codebase 🤔. So your current binary being used does not SEGV, but this one does? I wonder if there's some other diff than just a new contour git commit. Is your current executable also using the same Qt version (v5 vs v6)?

We're in the middle of releasing 0.6.0 from current master. I'm afraid this will then most likely affect you there as well.

@Yaraslaut did we change anything wrt. Audio recently?

@christianparpart christianparpart added platform: FreeBSD FreeBSD platform specific frontend Contour Terminal Emulator (GUI frontend) labels Dec 26, 2024
@Yaraslaut
Copy link
Member

This is qt part of audio handling, and gstreamer is backend that qt uses

@herrhotzenplotz
Copy link
Contributor Author

I'm sorry to hear that. Looking at the stacktrace, I feel like
there's not much caused by our own codebase 🤔. So your
current binary being used does not SEGV, but this one does?

Funnily I rebuilt an old version with my ports makefile and now it suddenly segfaults too...

I wonder if there's some other diff than just a new contour git commit.

Likely ...

Is your current executable also using the same Qt version (v5 vs v6)?

I built a working contour against Qt 6 before.
So this is not the issue.
Also, other applications using Qt 6 with audio are working just fine...

Thus it could be some change in Qt introducing a bug which is now triggered by contour.

Also, in the meantime I have upgraded my machine to FreeBSD 14.2 though I don't believe that this is the underlying cause of the issue.

Maybe the way to go is to install qt6-multimedia and qt6-multimediaquick with debug info and start digging... That will take some time though.

@christianparpart
Copy link
Member

@herrhotzenplotz Hey. I sadly don't have any seriously practical experience with FreeBSD.
If there is anything we can help you with digging, don't hesitate to ping us.

NB: I feel like we're getting also other people reporting issues with respect to audio - also on Linux. I think that's down to Qt here. Maybe we should see how other Qt apps are using Qt's audio API to try to guesstimate how to better guard against 🤔 potential pitfalls...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Contour Terminal Emulator (GUI frontend) platform: FreeBSD FreeBSD platform specific
Projects
None yet
Development

No branches or pull requests

3 participants