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
Enforce Linux pids as pid_t
(or i32
).
#3764
Conversation
Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
Nice, it looks like this work pre-dated the Docker exporting work in |
I can carry it through @fnichol thanks! |
Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>
Signed-off-by: mwrock <matt@mattwrock.com>
13ef345
to
5fb74e5
Compare
My commit adds a solution to the launcher reaping issues. The protocol change seems innocent but I'd be curious what others think. |
Signed-off-by: mwrock <matt@mattwrock.com>
@mwrock I think the protocol change is ok. Since it's still a 32 bit integer you'll just get integer wrapping at the worst and you're handling it on the Launcher's end. This looks good to me but we should do some testing in acceptance before we push it out :) |
While this doesn't completely solve the Launcher reaping/log issues, it tries to correct the type mismatch with how we think about process ids in Linux.
The main work was to thread though the notion of a
Pid
alias type which was already present in the Windows implementation which helped to keep the calling functions basically generic enough.One small wrinkle which may not be the best is that I made the protocol level representation an
int64
. Why? Because in Linux we are dealing with anint32
and this fits in without overflow just fine. On Windows, the pid is auint32
which also fits into theint64
. There are only 2 issues in my mind here: 1) there's a bit of casting going into and out of the wire, but since we only ever communicate with ourselves on the same host/kernel, we always know what we expect to find (this is a bit like generics in Java) and 2) I modified an existing protocol type, but since this only happens in memory on the host, both sides upgrade in lock step.Thoughts? Is this useful? I was using a Launch and Supervisor with this change for a week in my Builder development container when working on the
builder-worker
and I can confirm that I was seeing negative pid numbers with this change, and theabs(pid)
was the real, correct pid of the service.