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

Remove the call to isAlive() which is broken #17

Merged
merged 2 commits into from
Apr 6, 2024

Conversation

pshved
Copy link
Contributor

@pshved pshved commented Nov 4, 2022

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of pthread_kill. It used to return an error when a dead thread exited, and now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a thread that died produces undefined behavior, so techincally 0 is valid result.

This isAlive() will return that a dead thread is alive in the newer glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which should behave correctly for dead threads.

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of
pthread_kill.  It used to return an error when a dead thread exited, and
now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a
thread that died produces undefined behavior, so techincally 0 is valid
result.

This isAlive() will return that a dead thread is alive in the newer
glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which
should behave correctly for dead threads.
@pshved
Copy link
Contributor Author

pshved commented Nov 4, 2022

This patch needs more work tho, with error conditions not being correctly handled. Hold off on accepting it please

@waltejon
Copy link

This commit helped me to fix #16.

do not spin forever if some thread is invalid or it's a EDEADLK
@pshved
Copy link
Contributor Author

pshved commented Nov 12, 2022

I've added a missing check for error, so this should be good to go.

thomasemter added a commit to thomasemter/bluespace_ai_xsens_ros_mti_driver that referenced this pull request Jan 25, 2023
bukharyi added a commit to MIMOSRobotics/bluespace_ai_xsens_ros_mti_driver that referenced this pull request Mar 2, 2023
reference 
1. https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/pull/17/files
2. bluespace-ai#17

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of pthread_kill. It used to return an error when a dead thread exited, and now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a thread that died produces undefined behavior, so techincally 0 is valid result.

This isAlive() will return that a dead thread is alive in the newer glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which should behave correctly for dead threads.
This was linked to issues Apr 6, 2024
@jpazhaya jpazhaya merged commit 6a35755 into bluespace-ai:ros2_0_galactic Apr 6, 2024
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.

Problem to launch (Ubuntu 22, ROS-2 Humble) ROS2 Humble
3 participants