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

(LTH-166) Check if waitpid was merely interrupted #305

Merged
merged 1 commit into from
Sep 18, 2019

Conversation

aduitsis
Copy link
Contributor

A signal may interrupt a system call such as waitpid, in which case it would return -1 but with errno set to EINTR. The typical solution is to run waitpid inside a while loop and continue looping while waitpid returns -1 with the errno variable is set to EINTR. This patch does exactly that.

This patch fixes this particularly nasty bug: https://tickets.puppetlabs.com/browse/FACT-2019, but one could easily imagine other strange bugs (or rather, Heisenbugs!!!) occurring as a result.

@puppetlabs-jenkins
Copy link
Contributor

Can one of the admins verify this patch?

@mihaibuzgau mihaibuzgau requested a review from a team September 13, 2019 13:22
@GabrielNagy
Copy link
Contributor

Hi @aduitsis,

Thanks for your contribution! I've changed the project of the ticket you opened to Leatherman, since the fix is being done here.

Two things:

  • please retarget your PR on the 1.4.x branch, so this gets in all our release streams
  • please amend your commit title to include the ticket name (i.e. (LTH-166) Check if waitpid was merely interrupted)

Thank you!

@puppetcla
Copy link

CLA signed by all contributors.

@aduitsis aduitsis changed the title Check if waitpid was merely interrupted (LTH-166) Check if waitpid was merely interrupted Sep 13, 2019
A signal may interrupt a system call such as waitpid, in which case it would return -1 but with errno set to EINTR. The typical solution is to run waitpid inside a while loop and continue looping while waitpid returns -1 with the errno variable is set to EINTR. This patch does exactly that.

This patch fixes this particularly nasty bug: https://tickets.puppetlabs.com/browse/FACT-2019, but one could easily imagine other strange bugs (or rather, Heisenbugs!!!) occurring as a result.
@aduitsis aduitsis changed the base branch from master to 1.4.x September 13, 2019 21:57
@aduitsis aduitsis changed the base branch from 1.4.x to master September 13, 2019 21:58
@aduitsis aduitsis changed the base branch from master to 1.4.x September 13, 2019 22:11
@aduitsis
Copy link
Contributor Author

Hi @aduitsis,

Thanks for your contribution! I've changed the project of the ticket you opened to Leatherman, since the fix is being done here.

Two things:

  • please retarget your PR on the 1.4.x branch, so this gets in all our release streams
  • please amend your commit title to include the ticket name (i.e. (LTH-166) Check if waitpid was merely interrupted)

Thank you!

Hello,

Changed the name, retargeted to branch 1.4.x. Note, I took it from the master and sent it to 1.4.x, is that okay?

Thanks!

@puppetcla
Copy link

CLA signed by all contributors.

@allanjude
Copy link

I can confirm this issue with leatherman was breaking facter and puppet on FreeBSD with ruby 2.6. Applying this patch resolves the issue.

More detail and debug output in our issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240566

Copy link
Contributor

@GabrielNagy GabrielNagy left a comment

Choose a reason for hiding this comment

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

looks pretty straightforward to me 👍

@GabrielNagy GabrielNagy merged commit 9289ee5 into puppetlabs:1.4.x Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants