Repository navigation
fix: segfault in OpenSwathWorkflow with use_consensus=false - #9143
Conversation
When use_consensus=false, each transition gets individual peak boundaries from pickApex. PeakIntegrator::integratePeak produces hull_points of different sizes per transition (only points within local boundaries). These hull_points become intensity vectors for cross-correlation scoring in MRMScoring::initializeXCorrMatrix. Scoring::calculateCrossCorrelation assumes equal-sized vectors and reads past the end of the shorter one via Eigen::Map, causing a segfault. Fix: after integratePeak, override hull_points with the full resampled chromatogram (always master_peak_container-sized) in non-consensus mode. This preserves correct per-transition area/height/apex while ensuring equal-sized intensity vectors for scoring. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📝 WalkthroughWalkthroughPeak construction now conditionally replaces each feature's convex-hull points with intensity samples from the full resampled chromatogram when Changes
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The hull_points size check verifies the data structure, but the actual crash occurred in MRMScoring::initializeXCorrMatrix when cross- correlating different-sized intensity vectors. This test wraps the non-consensus features in MRMFeatureOpenMS and runs the full cross-correlation scoring — the exact code path that segfaulted. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/tests/class_tests/openms/source/MRMTransitionGroupPicker_test.cpp`:
- Around line 475-484: Replace the owning raw pointer usage with a
stack-allocated MRMFeatureOpenMS and pass its address to initializeXCorrMatrix:
instead of allocating imrmfeature via new and deleting it, create a local
MRMFeatureOpenMS instance (e.g., MRMFeatureOpenMS imrmfeature(mrmfeature)) and
call mrmscore.initializeXCorrMatrix(&imrmfeature, native_ids); then call
mrmscore.calcXcorrCoelutionScore() and mrmscore.calcXcorrShapeScore() as before
and remove the delete imrmfeature; line. This keeps the same behavior while
using RAII and avoiding manual delete.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4ad7d94b-8ec0-4f74-b45b-c67a476d0b48
📒 Files selected for processing (1)
src/tests/class_tests/openms/source/MRMTransitionGroupPicker_test.cpp
|
Looks reasonable. I never use consensus = false so it makes sense it was latent for a long time. |
Add two missing changelog entries for commits after the last sync (#9140): - #9139: Transparent .zip decompression for XML formats and Bruker .d - #9143: Fix segfault in OpenSwathWorkflow with use_consensus=false Co-authored-by: Copilot <[email protected]>
Add two missing changelog entries for commits after the last sync (#9140): - #9139: Transparent .zip decompression for XML formats and Bruker .d - #9143: Fix segfault in OpenSwathWorkflow with use_consensus=false Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
Fixes #9138 — OpenSwathWorkflow segfaults when
use_consensus=falsewithdetecting=1andquantifying=1.PeakIntegrator::integratePeakproduces hull_points of different sizes per transition (each clipped to its own peak boundaries). These become intensity vectors forScoring::calculateCrossCorrelation, which assumes equal-sized vectors and reads past the end of the shorter one viaEigen::Map.integratePeak, override hull_points with the full resampled chromatogram (alwaysmaster_peak_container-sized) in non-consensus mode. Area, height, and apex position remain computed with per-transition boundaries (unchanged behavior).Bug has been latent since the
use_consensus=falsefeature was introduced in April 2018.Test plan
MRMTransitionGroupPicker_testpasses (existing values unchanged)MRMTransitionGroupPickerintegration tests pass (FuzzyDiff output match)🤖 Generated with Claude Code
Summary by CodeRabbit