Skip to content

fix: guard debug print in CudaTrackBuilding against small bounds vectors#5067

Open
murnanedaniel wants to merge 2 commits intoacts-project:mainfrom
murnanedaniel:fix/cuda-track-building-debug-print
Open

fix: guard debug print in CudaTrackBuilding against small bounds vectors#5067
murnanedaniel wants to merge 2 commits intoacts-project:mainfrom
murnanedaniel:fix/cuda-track-building-debug-print

Conversation

@murnanedaniel
Copy link
Copy Markdown
Contributor

When numberLabels < 3, bounds.size() < 4, so accessing bounds.at(2) and bounds.at(numberLabels - 2) in the ACTS_DEBUG print caused an std::out_of_range crash.

Guard the detailed print behind a size check and fall back to printing all elements for small vectors.

PLEASE DESCRIBE YOUR CHANGES.
THIS MESSAGE ENDS UP AS THE COMMIT MESSAGE.
DO NOT USE @-MENTIONS HERE!

--- END COMMIT MESSAGE ---

Any further description goes here, @-mentions are ok here!

  • Use a conventional commits prefix: quick summary
    • We mostly use feat, fix, refactor, docs, chore and build types.
  • A milestone will be assigned by one of the maintainers

@github-actions github-actions bot added this to the next milestone Feb 6, 2026
@github-actions github-actions bot added the Component - Plugins Affects one or more Plugins label Feb 6, 2026
@murnanedaniel
Copy link
Copy Markdown
Contributor Author

A little extra context: This is killing GNN testing when running on single particles, since a correctly reconstructed event will give just one label, which crashes this debug line.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

📊: Physics performance monitoring for ce6fbb1

Full contents

physmon summary

Comment on lines +136 to +143
std::ostringstream oss;
for (std::size_t i = 0; i < bounds.size(); ++i) {
if (i > 0) {
oss << ", ";
}
oss << bounds[i];
}
ACTS_DEBUG("Bounds: " << oss.str());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just do this in all cases? You could use a range based for loop and an immediately executing lambda to put this inside the log macro even.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will make the fix

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm not sure what you mean with all cases, but we should not print out 150k-300k labels in DEBUG mode...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at the attempted fix:

  • Iterates over the first min(3, bounds.size)
  • Then iterates over the last min(3, bounds.size-3)
    more or less

benjaminhuth
benjaminhuth previously approved these changes Feb 9, 2026
Copy link
Copy Markdown
Member

@benjaminhuth benjaminhuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

Comment on lines +136 to +143
std::ostringstream oss;
for (std::size_t i = 0; i < bounds.size(); ++i) {
if (i > 0) {
oss << ", ";
}
oss << bounds[i];
}
ACTS_DEBUG("Bounds: " << oss.str());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm not sure what you mean with all cases, but we should not print out 150k-300k labels in DEBUG mode...

When numberLabels < 3, bounds.size() < 4, so accessing bounds.at(2)
and bounds.at(numberLabels - 2) in the ACTS_DEBUG print caused an
std::out_of_range crash. Guard the detailed print behind a size check
and fall back to printing all elements for small vectors.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud
Copy link
Copy Markdown

@github-actions github-actions bot added the Stale label Mar 12, 2026
@AJPfleger
Copy link
Copy Markdown
Contributor

Hi @murnanedaniel @paulgessinger @benjaminhuth what's the status on this PR?

@github-actions github-actions bot removed the Stale label Mar 24, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Plugins Affects one or more Plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants