Skip to content

Fix race condition in test clock #2819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

pedroazeredo04
Copy link
Contributor

@pedroazeredo04 pedroazeredo04 commented Apr 16, 2025

This Pull Request intends to fix the issue #2804

In order to do so, I first ran helgrind on the code, and found that there existed a race condition in a vector of booleans. Afterwards, I changed this vector to std::atomic_bool . With that, I ran the helgrind again, and found there was no more race condition.

This is the full log of helgrind for the original code.
This is the full log of helgrind for the modified code.

Note that, since they are the full log of the helgrind, in both of these snippets, there are some unrelated warnings. However, by searching for data race inside this logs, it is possible to see that they were corrected.

This is my first Pull Request, so if there are any changes I still have to do, please let me know.
(Edit: I just realized my signature in the commit was wrong. I believe I have corrected it, hopefully everything is OK now)

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

lgtm.

@pedroazeredo04 thank you very much for creating PR. can you retarget this PR against rolling branch? that is our development branch where all fixes are supposed to be merged in rolling, and then we can backport the fixes to released distro such as jazzy?

@pedroazeredo04 pedroazeredo04 changed the base branch from jazzy to rolling April 17, 2025 21:07
@pedroazeredo04
Copy link
Contributor Author

@fujitatomoya

So, I retargeted this PR to the rolling branch, but it seems like there are some conflicts because my original branch was based on jazzy. Should I do a rebase, or would it be better to create a new branch and a new PR?

@fujitatomoya
Copy link
Collaborator

@Mergifyio rebase

Copy link
Contributor

mergify bot commented Apr 18, 2025

rebase

☑️ Nothing to do

  • -conflict [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]
  • any of:
    • #commits > 1 [📌 rebase requirement]
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]

@fujitatomoya
Copy link
Collaborator

@pedroazeredo04 i tried to rebase by Mergifyio, but it did not work. yes, please rebase this to rolling branch.

@jmachowinski
Copy link
Collaborator

I recommend not doing a rebase, but instead cherry pick your commit on rolling. Afterwards force push to your branch for this pr.

Signed-off-by: pedroazeredo04 <[email protected]>
Signed-off-by: Pedro Nogueira <[email protected]>
@pedroazeredo04 pedroazeredo04 force-pushed the fix_test_clock_race_condition branch from 78411a6 to d3ccb3b Compare April 18, 2025 09:07
@pedroazeredo04
Copy link
Contributor Author

Nice, thanks a lot @fujitatomoya and @jmachowinski. At the end, I did the cherry pick and force push, it looks like it worked. I was a bit scared about the rebase, there were a lot of conflicts and I was worried about messing up something ahahaha

@jmachowinski
Copy link
Collaborator

Pulls: #2819
Gist: https://gist.githubusercontent.com/jmachowinski/3ccac15337693ffaf740c9e338fc3912/raw/d459b0ee51366d0ba3086e2b4743e9b7b48c536f/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15716

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@jmachowinski
Copy link
Collaborator

Test failure on Linux is unrelated

@jmachowinski jmachowinski merged commit 8e49bef into ros2:rolling Apr 18, 2025
2 of 3 checks passed
@jmachowinski
Copy link
Collaborator

Thanks for the PR @pedroazeredo04

@fujitatomoya
Copy link
Collaborator

@jmachowinski we are currently branching on freeze...?

@fujitatomoya
Copy link
Collaborator

@Mergifyio backport jazzy

Copy link
Contributor

mergify bot commented Apr 18, 2025

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Apr 18, 2025
Signed-off-by: pedroazeredo04 <[email protected]>
Signed-off-by: Pedro Nogueira <[email protected]>
(cherry picked from commit 8e49bef)
@jmachowinski
Copy link
Collaborator

@jmachowinski we are currently branching on freeze...?

There was a message the rolling sync was done. Are we still on freeze?

@christophebedard
Copy link
Member

We're still in the freeze. The Rolling sync is for binary releases (related to rosdistro).

@christophebedard
Copy link
Member

That being said, this only changes a test and does fix an issue, so it's probably fine!

MichaelOrlov added a commit that referenced this pull request May 1, 2025
Fix race condition in test clock (backport #2819)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants