Skip to content
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

Fix sros2 tests on Windows Debug. #317

Merged
merged 1 commit into from
May 23, 2024

Conversation

clalancette
Copy link
Contributor

@clalancette clalancette commented May 22, 2024

From what I can tell, it looks like lxml has a bug where it doesn't properly track references to objects via the find() method. This manifests on Windows debug as a crash after we have stopped using the object, but I believe that by that point the underlying memory has already been freed. Windows Debug in particular is sensitive to this.

Fix it by doing a deepcopy of the object returned from the find(). This code isn't performance sensitive, so it shouldn't be a big deal to do it here, and it fixes the bug in my testing.

@mikaelarguedas
Copy link
Member

Thanks 🙏

Ideally I'd like to keep separate the behavioral fix and API/signature change to streamline fix back porting to older distros.
Regarding the mutable defaults 👍 (hence the frecebtly added file), however what would you think about making all ARGS keyed-args and keeping the order as is ?

Finally is it possible to trigger a windows debug job once the PR splitted to make sure the CI is happy about it ?

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.94%. Comparing base (fb22661) to head (4f136df).

Additional details and impacted files
@@             Coverage Diff             @@
##           rolling     #317      +/-   ##
===========================================
+ Coverage    88.92%   88.94%   +0.01%     
===========================================
  Files           24       24              
  Lines          614      615       +1     
  Branches        64       64              
===========================================
+ Hits           546      547       +1     
  Misses          50       50              
  Partials        18       18              
Flag Coverage Δ
unittests 88.94% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clalancette
Copy link
Contributor Author

however what would you think about making all ARGS keyed-args and keeping the order as is ?

Actually, to be perfectly frank we could just leave the order as-is and remove all of the default arguments. This function is always called with all of its arguments. So I think I'll open a separate PR to do that.

From what I can tell, it looks like lxml has a bug
where it doesn't properly track references to objects
via the find() method.  This manifests on Windows debug
as a crash *after* we have stopped using the object, but
I believe that by that point the underlying memory has
already been freed.  Windows Debug in particular is sensitive
to this.

Fix it by doing a deepcopy of the object returned from the
find().  This code isn't performance sensitive, so it shouldn't
be a big deal to do it here, and it fixes the bug in my testing.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette clalancette force-pushed the clalancette/fix-windows-debug branch from 34ac294 to 4f136df Compare May 22, 2024 19:36
@clalancette
Copy link
Contributor Author

Here is just CI on Windows Debug. Assuming this is successful, I'll run full CI on it:

  • Windows Debug Build Status

@clalancette
Copy link
Contributor Author

And see #318 for the rest of the fixes.

Copy link
Contributor

@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 with green CI, thanks for the fix.

@clalancette
Copy link
Contributor Author

And here is full CI:

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

@mikaelarguedas
Copy link
Member

Cheers!

@mikaelarguedas mikaelarguedas merged commit bbccb6a into rolling May 23, 2024
7 checks passed
@mikaelarguedas mikaelarguedas deleted the clalancette/fix-windows-debug branch May 23, 2024 05:25
@mikaelarguedas
Copy link
Member

@Mergifyio backport jazzy

Copy link

mergify bot commented May 26, 2024

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 26, 2024
From what I can tell, it looks like lxml has a bug
where it doesn't properly track references to objects
via the find() method.  This manifests on Windows debug
as a crash *after* we have stopped using the object, but
I believe that by that point the underlying memory has
already been freed.  Windows Debug in particular is sensitive
to this.

Fix it by doing a deepcopy of the object returned from the
find().  This code isn't performance sensitive, so it shouldn't
be a big deal to do it here, and it fixes the bug in my testing.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit bbccb6a)
mikaelarguedas pushed a commit that referenced this pull request May 26, 2024
From what I can tell, it looks like lxml has a bug
where it doesn't properly track references to objects
via the find() method.  This manifests on Windows debug
as a crash *after* we have stopped using the object, but
I believe that by that point the underlying memory has
already been freed.  Windows Debug in particular is sensitive
to this.

Fix it by doing a deepcopy of the object returned from the
find().  This code isn't performance sensitive, so it shouldn't
be a big deal to do it here, and it fixes the bug in my testing.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit bbccb6a)

Co-authored-by: Chris Lalancette <clalancette@gmail.com>
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.

👩‍🌾 Windows debug Windows fatal exception: access violation build regression
3 participants