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: Make DataHandle type check more robust #3768

Merged
merged 4 commits into from
Oct 22, 2024

Conversation

andiwand
Copy link
Contributor

It seems that the current implementation is prone to symbol hiding. I worked around this by inserting another non-templated layer in the class hierarchy which can do the type check more reliably.

The origin of the problem could be -fvisibility=hidden being toggled on all of my ActsPythonBindings compilation commands. It might be that this is another case where this flag leaks in via CMake from another library. I also did not want to change the visibility of the symbol manually as this would require some macros to be compiler agnostic.

Some resources

@andiwand andiwand added this to the next milestone Oct 21, 2024
@github-actions github-actions bot added the Component - Examples Affects the Examples module label Oct 21, 2024
@paulgessinger
Copy link
Member

I think you didn't commit the DataHandle.cpp.

This now works because the base classes are compiled in the same shared library and the template classes remain in the separate libs, but that doesn't matter anymore?

Does the hiding leak from the Python binding lib, or is it just that in the Python lib the symbols are hidden?

Copy link

github-actions bot commented Oct 21, 2024

📊: Physics performance monitoring for 94c6c3b

Full contents

physmon summary

paulgessinger
paulgessinger previously approved these changes Oct 22, 2024
Copy link

sonarcloud bot commented Oct 22, 2024

@kodiakhq kodiakhq bot merged commit f537267 into acts-project:main Oct 22, 2024
42 checks passed
@andiwand andiwand deleted the ex-fix-data-handle-type-check branch October 22, 2024 17:47
@paulgessinger paulgessinger modified the milestones: next, v37.2.0 Oct 24, 2024
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
It seems that the current implementation is prone to symbol hiding. I worked around this by inserting another non-templated layer in the class hierarchy which can do the type check more reliably.

The origin of the problem could be `-fvisibility=hidden` being toggled on all of my `ActsPythonBindings` compilation commands. It might be that this is another case where this flag leaks in via CMake from another library. I also did not want to change the visibility of the symbol manually as this would require some macros to be compiler agnostic.

Some resources
- https://www.qt.io/blog/quality-assurance/one-way-dynamic_cast-across-library-boundaries-can-fail-and-how-to-fix-it
- https://developers.redhat.com/articles/2021/10/27/compiler-option-hidden-visibility-and-weak-symbol-walk-bar#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants