Skip to content
Qt 6.11 is out! See what's new in the release blog
  • 145k Topics
    725k Posts
    V
    Possible thread stack size problem on macOS with deep recursion Hello, I am the co-developer of FET, a Qt-based timetabling application, and I am investigating an intermittent crash reported by a macOS user. The application performs timetable generation in several worker threads. Currently these threads are created using std::thread, for example: std::thread([t]{ timetablingThreads[t].startGenerating(); }).detach(); The generation algorithm contains a large recursive function, Generate::randomSwap(). The recursion depth is explicitly limited to 14. The user reported that with multiple generation threads the application sometimes crashes on macOS, while single-thread generation seems stable. The original macOS crash report showed memory allocation functions such as QArrayData::allocate() / malloc(), which initially made me suspect heap corruption. To investigate this I built FET with AddressSanitizer: -O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls and linked with: -fsanitize=address ASan is definitely active. With ASan, the problem becomes reproducible almost immediately. ASan reports: ERROR: AddressSanitizer: stack-overflow The worker-thread stack reported by ASan is approximately: size 0x83000 so roughly 524 KiB. The stack trace contains many recursive calls like: Generate::randomSwap(int, int) generate.cpp:38619 Generate::randomSwap(int, int) generate.cpp:38619 ... until ASan reports the stack overflow. As a test, I replaced the std::thread creation with QThread::create() and explicitly set a larger stack: QThread* thread = QThread::create([t]{ timetablingThreads[t].startGenerating(); }); thread->setStackSize(16 * 1024 * 1024); connect(thread, &QThread::finished, thread, &QObject::deleteLater); thread->start(); With this change, the immediate ASan stack overflow disappears and generation continues normally for much longer. So my questions are: Does this look like a normal consequence of the relatively small default worker-thread stack on macOS, especially with ASan and a large recursive function? Would explicitly increasing the thread stack size be the appropriate permanent fix for this kind of application? Is there anything Qt-specific I should consider when using QThread::setStackSize() on macOS? Could the original non-ASan crash, which appeared inside malloc() / QArrayData::allocate(), plausibly have been another manifestation of stack exhaustion, or should I continue looking for an independent heap corruption/data race? Is 16 MiB a reasonable stack size here, or would you recommend another approach? Environment: macOS on Apple Silicon Qt 6.11.x Clang / Xcode C++17 FET timetable generator up to 4 generation threads in the reported case recursion depth limited to 14 I would appreciate any advice on whether increasing the worker-thread stack is the correct solution, or whether there is something else I should investigate before making this change permanent.
  • Jobs, project showcases, announcements - anything that isn't directly development
    4k 23k
    4k Topics
    23k Posts
    SGaistS
    @yungys said in Looking for Desktop Engineer (Electron, TS, React) for Private Client: @hskoglund That’s a fair point. By “lightweight,” I mean the application itself — a compact desktop client with a focused feature set and minimal resource overhead, rather than a claim about the technology stack. Electron, TypeScript, and React are simply the technologies we’re planning to use. Then my question stands: in what way is this job offer related to Qt ?
  • Everything related to designing and design tools

    133 399
    133 Topics
    399 Posts
    JKSHJ
    Hi, and welcome! @Arthurium said in Looking for a Penpot plugin to integrate my workflow with Qt Design Studio: In the CoMaps project I would make designs to help the Qt-based desktop UI forward, which is currently in an experimental state. I had a quick look at the CoMaps source code, and I saw that they use Qt Widgets (not Qt Quick/QML) for their GUIs: https://codeberg.org/comaps/comaps/src/branch/main/qt/qt_common/map_widget.hpp Can you confirm if Qt Quick integration is in the works? To accommodate designers, the Qt company over the years made Qt Design Studio bridge plugins for Adobe Illustrator, Adobe Photoshop, Adobe XD, Sketch and Figma. But I'm not happy with this, as these software and plugins are proprietary, and all except for the Figma plugin require enterprise licenses. To be precise, the tools that need Qt Design Studio Enterprise licenses are the old "Qt Bridges" (including Qt Bridge for Figma). These are now deprecated, replaced by the Figma to Qt plugin: https://www.qt.io/blog/figma-to-qt-1.0 The Figma to Qt plugin... Does not require an Enterprise license Does not require Qt Design Studio either! Some parts are not very streamlined, having to sometimes learn a bit of QML syntax (and I don't like to program). Hmm... You can do all your visual design in Figma/Penpot. But even after you manage to convert the Penpot designs to QML, and even if CoMaps is offering Qt Quick integration, you'd still to do some programming to make your QML files interactive, read the data sources, and transform the data to on-screen visuals. Qt Design Studio won't really add value to your workflow... what you need is a partner who's a programmer/developer (or spend some time learning it yourself). I'm wondering how complex a Penpot plugin to export components (with its states/overlays) to Qt Design Studio would be? I guess that would depend on the developer's experience in writing Penpot plugins, their knowledge of QML, and their general software engineering skills. And would anybody here have the motivation to make one? I'm happy to help answer questions about using QML or Qt Widgets, but I'm not in a position to contribute code directly to the plugin. Others might.
  • Everything related to the Software Quality Tools

    96 267
    96 Topics
    267 Posts
    Arsh129A
    Classic off-by-one and coordinate offset traps! Mixing up button bitmasks (like 4 vs 1) and missing container bounds will throw off any automation instantly. Good catches tracking those down.
  • Everything related to learning Qt.

    401 2k
    401 Topics
    2k Posts
    Nils SjobergN
    Nice..now he knew whether to perform certification
  • 2k Topics
    13k Posts
    SGaistS
    Please check with the Gerrit admins if that is doable.
  • 4k Topics
    18k Posts
    S
    可以换个账号试试
  • This is where all the posts related to the Qt web services go. Including severe sillyness.
    1k 10k
    1k Topics
    10k Posts
    M
    I had the same “You are not authorized” error when trying to create a Jira ticket. AlexBlasche’s fix works perfectly, use the direct login URL first