SG-38851: Fix random segfault in test tearDown with Qt event processing#1085
Draft
julien-lang wants to merge 3 commits intomasterfrom
Draft
SG-38851: Fix random segfault in test tearDown with Qt event processing#1085julien-lang wants to merge 3 commits intomasterfrom
julien-lang wants to merge 3 commits intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1085 +/- ##
==========================================
- Coverage 79.65% 79.64% -0.01%
==========================================
Files 198 198
Lines 20620 20620
==========================================
- Hits 16424 16422 -2
- Misses 4196 4198 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes random segmentation faults during test tearDown when Qt objects are destroyed.
Problem:
Tests randomly fail with segfault in tearDown across all platforms (Linux, Windows, macOS) and Python versions. The crash occurs after all Python code completes, during Qt object destruction at line 105 in tests/external_config/init.py.
Root Cause:
Qt's deleteLater() mechanism creates deferred deletions that aren't processed before tearDown completes, leaving dangling pointers that cause segfaults during C++ cleanup.
Solution:
Added cleanup_qtapp() method that calls QCoreApplication.processEvents() twice to allow Qt's event loop to process all deferred deletions before clearing global shotgun connections.
Testing:
Includes debug logging and 2-second sleep for verification. Will remove after CI confirms the fix works.