Skip to content

Conversation

@henrylay97
Copy link
Member

@henrylay97 henrylay97 commented Jan 31, 2025

Description

@RachelCoackley discovered this problem using the SBND CI. We were seeing non-reproducibility in the CAFs. @jzennamo traced this down to this tool using valgrind to find an invalid read. I have then investigated why it was happening.

Description copied from slack:

  • The if statements here on lines 33 & 36 are not mutually exclusive and yet they both add a default value to the vector dtheta.
  • If both evaluate to true then the vector grows by 2 entries during this iteration of the loop. This makes it longer than other vectors such as cumLenFwd and cumLenBwd which are meant to be of the same length.
  • It is the dtheta vector's size (after passing to other functions) that determines the domain of the loop on line 224 (by setting beg & end at lines 211 & 212.
  • This allows invalid reads of cumLen on lines 232 or 236.
  • The simplest fix is very simple, just an else if not an if and I'm not willing to do anything more than the most simple!
  • I've run my little bash script that does 20 iterations of the command run by the CI and they all come back the same - whereas before at least 5 or 6 were showing the random differences.

For the sake of the SBND CI there is a branch based on v09_93_01_p02 bugfix/hlay_mcs_invalid_read but this PR branch is rebased against develop.

I've added review requests from @gputnam and @wjdanswjddl as I see you have previous commits on this tool so may want to see this. The okay from Rachel or Joseph should be fine from the bugfix side of things though.

  • Have you added a label? (bug/enhancement/physics etc.)
  • Have you assigned at least 1 reviewer?
  • Is this PR related to an open issue / project?
  • Does this PR affect CAF data format? If so, please assign a CAF maintainer as additional reviewer.
  • Does this PR require merging another PR in a different repository (such as sbnanobj/sbnobj etc.)? If so, please link it in the description.
  • Are you submitting this PR on behalf of someone else who made the code changes? If so, please mention them in the description.

@henrylay97 henrylay97 added the bug Something isn't working label Jan 31, 2025
@henrylay97 henrylay97 self-assigned this Jan 31, 2025
@jzennamo
Copy link
Contributor

Thank you @henrylay97! I look forward to the results of @RachelCoackley's CI test

Copy link

@RachelCoackley RachelCoackley 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 fixing this Henry!! :) These warnings no longer appeared in the CI tests

@ibsafa ibsafa merged commit 2b9cf8d into develop Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants