Skip to content

Shim locking improvements and context cancel#2589

Merged
crosbymichael merged 2 commits intocontainerd:masterfrom
crosbymichael:shim-robo
Aug 30, 2018
Merged

Shim locking improvements and context cancel#2589
crosbymichael merged 2 commits intocontainerd:masterfrom
crosbymichael:shim-robo

Conversation

@crosbymichael
Copy link
Copy Markdown
Member

This improves shim locking where we only hold the lock for shim state, and not system level operations.

@crosbymichael crosbymichael added this to the 1.2 milestone Aug 28, 2018
@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 28, 2018

Codecov Report

Merging #2589 into master will increase coverage by 3.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2589      +/-   ##
==========================================
+ Coverage   40.97%   44.05%   +3.08%     
==========================================
  Files          69       98      +29     
  Lines        8350    10130    +1780     
==========================================
+ Hits         3421     4463    +1042     
- Misses       4385     4945     +560     
- Partials      544      722     +178
Flag Coverage Δ
#linux 47.79% <ø> (?)
#windows 40.97% <ø> (ø) ⬆️
Impacted Files Coverage Δ
mount/temp_unix.go 0% <0%> (ø)
sys/reaper_linux.go 0% <0%> (ø)
services/server/server_linux.go 0% <0%> (ø)
sys/env.go 100% <0%> (ø)
oci/spec_opts_unix.go 17.59% <0%> (ø)
sys/stat_unix.go 0% <0%> (ø)
sys/reaper.go 0% <0%> (ø)
sys/fds.go 0% <0%> (ø)
sys/proc.go 0% <0%> (ø)
sys/mount_linux.go 0% <0%> (ø)
... and 25 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 d89ba5e...2205e8d. Read the comment docs.

@crosbymichael crosbymichael changed the title Shim locking improvments and context cancel Shim locking improvements and context cancel Aug 28, 2018
@Random-Liu
Copy link
Copy Markdown
Member

As long as Process is thread safe, this PR LGTM. However, operations could still block each other inside Process, given that each operation grab a lock.

Anyway, this is still better than before. :)

@crosbymichael
Copy link
Copy Markdown
Member Author

@Random-Liu process is threadsafe. And this is the start of various fixes. I'm getting timeouts working for ttrpc clients, etc

@Random-Liu
Copy link
Copy Markdown
Member

@crosbymichael SGTM. Thanks a lot! :)

Signed-off-by: Michael Crosby <[email protected]>
Copy link
Copy Markdown
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread runtime/v2/runc/service.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: could avoid the defer cost here

Only lock around shim state and not on actions

Signed-off-by: Michael Crosby <[email protected]>
Comment thread runtime/v2/runc/epoll.go
n, err := unix.EpollWait(e.fd, events[:], -1)
if err != nil {
if err == unix.EINTR {
continue
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.

Probably OK since this is the last item in the select, but may want to make sure this continues the loop rather than the select.

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.

Actually, with the 2nd for loop below, this may or may not be working as expected.

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.

you break out of selects, you continue for loops

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.

Ah, I always mess these up.

@ehazlett
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit 0649e38 into containerd:master Aug 30, 2018
@crosbymichael crosbymichael deleted the shim-robo branch August 30, 2018 14:19
if err != nil {
return nil, errdefs.ToGRPC(err)
}
s.mu.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.

Should this check existence again after the lock is reacquired or is that condition not possible?

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.

7 participants