Skip to content

Robust pid locking for shim processes#3366

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
crosbymichael:exec-pid
Jun 29, 2019
Merged

Robust pid locking for shim processes#3366
dmcgowan merged 1 commit intocontainerd:masterfrom
crosbymichael:exec-pid

Conversation

@crosbymichael
Copy link
Copy Markdown
Member

Closes #2832

Signed-off-by: Michael Crosby crosbymichael@gmail.com

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jun 21, 2019

Build succeeded.

Copy link
Copy Markdown
Contributor

@jterry75 jterry75 left a comment

Choose a reason for hiding this comment

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

Questions

@crosbymichael crosbymichael force-pushed the exec-pid branch 2 times, most recently from 5d4f97c to 4d28a19 Compare June 25, 2019 16:51
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jun 25, 2019

Build succeeded.

@crosbymichael
Copy link
Copy Markdown
Member Author

@jterry75 updated

Closes containerd#2832

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jun 26, 2019

Build succeeded.

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #3366 into master will decrease coverage by 4.8%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3366      +/-   ##
==========================================
- Coverage   45.08%   40.28%   -4.81%     
==========================================
  Files         113       76      -37     
  Lines       12542    10484    -2058     
==========================================
- Hits         5654     4223    -1431     
+ Misses       6032     5676     -356     
+ Partials      856      585     -271
Flag Coverage Δ
#linux ?
#windows 40.28% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
cio/io.go 1.4% <0%> (-45.08%) ⬇️
snapshots/native/native.go 1.79% <0%> (-41.26%) ⬇️
archive/tar.go 16.99% <0%> (-26.8%) ⬇️
metadata/snapshot.go 24.02% <0%> (-23.5%) ⬇️
content/local/writer.go 57.69% <0%> (-0.97%) ⬇️
oci/spec_opts.go 30.33% <0%> (-0.25%) ⬇️
mount/temp_unix.go
sys/reaper_linux.go
services/server/server_linux.go
sys/env.go
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb9616b...719a2c5. Read the comment docs.

1 similar comment
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #3366 into master will decrease coverage by 4.8%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3366      +/-   ##
==========================================
- Coverage   45.08%   40.28%   -4.81%     
==========================================
  Files         113       76      -37     
  Lines       12542    10484    -2058     
==========================================
- Hits         5654     4223    -1431     
+ Misses       6032     5676     -356     
+ Partials      856      585     -271
Flag Coverage Δ
#linux ?
#windows 40.28% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
cio/io.go 1.4% <0%> (-45.08%) ⬇️
snapshots/native/native.go 1.79% <0%> (-41.26%) ⬇️
archive/tar.go 16.99% <0%> (-26.8%) ⬇️
metadata/snapshot.go 24.02% <0%> (-23.5%) ⬇️
content/local/writer.go 57.69% <0%> (-0.97%) ⬇️
oci/spec_opts.go 30.33% <0%> (-0.25%) ⬇️
mount/temp_unix.go
sys/reaper_linux.go
services/server/server_linux.go
sys/env.go
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb9616b...719a2c5. Read the comment docs.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

Just some questions on why we need to lock for create/start functions.

pio *processIO
pidFile = newPidFile(p.Bundle)
)
p.pid.Lock()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Curious about this lock.
If the pid is 0, can the rest of the code check that instead of holding a lock during this whole function?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is the create function so its safe to hold the lock until it's done

p := s.p
sio := p.stdio

p.pid.Lock()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same question as for Init above.

@dmcgowan
Copy link
Copy Markdown
Member

LGTM

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.

6 participants