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

Replace use of Process.getpgid which does not behave as intended on all platforms #1110

Merged
merged 2 commits into from
Dec 12, 2016

Conversation

montdidier
Copy link
Contributor

This pull request has two small fixes for issues I experienced with puma 3.6.0

  1. Using pumactl (3.6.0) on OSX it was possible to come cross uninitialised constant Puma::StateFile. I have rectified this.
  2. On some platforms (specifically encountered on OpenBSD) Process.getpgid which is backed by the POSIX.1 getgpid implementation does not behave in a fashion which the original implementer expected.

Process.getpgid is being used to confirm the existence of a running process before proceeding on to act upon said process.

Using this man page as a reference one can see that unless getpgid is called from within the same session as the running process a permission error will be returned. Considering the main uses cases; running in the same session will not be the norm. The exception handling block surrounding Porcess.getpgid does not differentiate between an unknown process id and permission denied. Therefore the error "unknown pid" is returned and execution ceases.

Considering that the various kill methods in waiting result in the same exception I decided to simply change the method logic from "asking permission" to "asking forgiveness" and circumventing the need for Process.getpgid all-together.

@montdidier
Copy link
Contributor Author

Looks like it was a hung build?

@nateberkopec
Copy link
Member

@montdidier Can you remove the Puma version bump and Puma::StateFile commits (so leaving only b7a6879). We're gonna fix the others separately. (cc #1138)

@nateberkopec
Copy link
Member

@montdidier LGTM but I don't think we have test coverage for the failure case? Can you add one?

@nateberkopec nateberkopec modified the milestone: 3.7.0 Nov 23, 2016
@montdidier
Copy link
Contributor Author

Sorry for slow response. Will update as requested.

@montdidier
Copy link
Contributor Author

Ok. I've removed the Puma version bump and Puma::StateFile and added a test to cover the failure case. Anything else?

@nateberkopec
Copy link
Member

Brilliant! We'll take it from here.

@nateberkopec nateberkopec merged commit ad3d867 into puma:master Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants