Skip to content

Don't cancel context passed to OpenFifo.#2944

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
Random-Liu:fix-stdin-close
Jan 23, 2019
Merged

Don't cancel context passed to OpenFifo.#2944
dmcgowan merged 1 commit intocontainerd:masterfrom
Random-Liu:fix-stdin-close

Conversation

@Random-Liu
Copy link
Copy Markdown
Member

@Random-Liu Random-Liu commented Jan 23, 2019

Fixes #2937
Fixes #2938

We can have a better fix after containerd/fifo#18 is addressed.

More details at #2944 (comment).
Signed-off-by: Lantao Liu [email protected]

@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Jan 23, 2019

This PR also removed the unused linter, because it has been removed from the upstream. alecthomas/gometalinter@96c7e2a

I keep getting this error without doing that:

$ make check
+ proto-fmt
+ check
gometalinter --config .gometalinter.json ./...
gometalinter: error: unknown linters: unused
Makefile:109: recipe for target 'check' failed
make: *** [check] Error 1

@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Jan 23, 2019

Hm, actually the change alecthomas/gometalinter@96c7e2a broke a ton of things:

gometalinter --config .gometalinter.json ./...
archive\tar_windows.go:77:24:warning: error strings should not be capitalized (ST1005) (staticcheck)
archive\tar_windows.go:133:2:warning: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008) (staticcheck)
cmd\containerd\command\service_windows.go:391:2:warning: should use for range instead of for { select {} } (S1000) (staticcheck)
container_test.go:139:24:warning: no value of type uint32 is less than 0 (SA4003) (staticcheck)
container_test.go:438:5:warning: no value of type uint32 is less than 0 (SA4003) (staticcheck)
container_test.go:788:24:warning: no value of type uint32 is less than 0 (SA4003) (staticcheck)
content\local\locks.go:50:2:warning: unnecessary guard around call to delete (S1033) (staticcheck)
diff\apply\apply.go:61:14:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
diff\lcow\lcow.go:102:14:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
diff\windows\windows.go:95:14:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
filters\scanner.go:188:2:warning: redundant return statement (S1023) (staticcheck)
import.go:102:2:warning: should merge variable declaration with assignment on next line (S1021) (staticcheck)
metadata\content.go:782:8:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
metadata\db.go:179:31:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
metadata\db.go:331:40:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
metadata\db.go:346:21:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
metadata\db.go:354:16:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
metadata\snapshot.go:631:8:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
pkg\progress\escape.go:22:2:warning: const red is unused (U1000) (staticcheck)
plugin\plugin.go:45:2:warning: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008) (staticcheck)
remotes\docker\auth.go:82:18:warning: should use strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) instead (S1003) (staticcheck)
remotes\docker\auth.go:83:6:warning: should use strings.ContainsRune(" \t\r\n", rune(c)) instead (S1003) (staticcheck)
runtime\v2\shim\shim_windows.go:111:2:warning: should use for range instead of for { select {} } (S1000) (staticcheck)
runtime\v2\shim\util_windows.go:57:26:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
runtime\v2\shim\util_windows.go:74:6:warning: should use time.Since instead of time.Now().Sub (S1012) (staticcheck)
services\containers\local.go:150:4:warning: should replace loop with fieldpaths = append(fieldpaths, req.UpdateMask.Paths...) (S1011) (staticcheck)
services\images\local.go:140:3:warning: should replace loop with fieldpaths = append(fieldpaths, req.UpdateMask.Paths...) (S1011) (staticcheck)
Makefile:109: recipe for target 'check' failed
mingw32-make: *** [check] Error 1

I'll make a quick change to stick to the commit before alecthomas/gometalinter@96c7e2a for this PR...

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2944 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2944   +/-   ##
=======================================
  Coverage   44.02%   44.02%           
=======================================
  Files         102      102           
  Lines       10870    10870           
=======================================
  Hits         4785     4785           
  Misses       5351     5351           
  Partials      734      734
Flag Coverage Δ
#linux 47.65% <ø> (ø) ⬆️
#windows 41.24% <ø> (ø) ⬆️

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 35582cb...92b89de. Read the comment docs.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 23, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2944      +/-   ##
==========================================
- Coverage   47.64%   44.02%   -3.63%     
==========================================
  Files          92      102      +10     
  Lines        8513    10870    +2357     
==========================================
+ Hits         4056     4785     +729     
- Misses       3730     5351    +1621     
- Partials      727      734       +7
Flag Coverage Δ
#linux 47.65% <ø> (ø) ⬆️
#windows 41.24% <ø> (?)
Impacted Files Coverage Δ
snapshots/native/native.go 43.04% <0%> (-9.99%) ⬇️
metadata/snapshot.go 45.8% <0%> (-8.96%) ⬇️
archive/tar.go 43.79% <0%> (-7.07%) ⬇️
metadata/containers.go 47.97% <0%> (-6.62%) ⬇️
content/local/writer.go 57.84% <0%> (-6.36%) ⬇️
content/local/store.go 48.51% <0%> (-5.03%) ⬇️
archive/tar_opts.go 28.57% <0%> (-4.77%) ⬇️
archive/compression/compression.go 58.69% <0%> (-4.7%) ⬇️
metadata/images.go 58.46% <0%> (-4.7%) ⬇️
metadata/buckets.go 56.33% <0%> (-4.6%) ⬇️
... and 59 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 aee74ad...26ab393. Read the comment docs.

@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Jan 23, 2019

IIUC, the timeout context added in #2877 is mainly for the blocking OpenFifo calls. However, it is fine to add it for non-blocking calls as well, because:

  1. We hold both writer and reader side in containerd, both goroutines in non-blocking OpenFifo should finish fast (<30s)
  2. If anything really goes wrong, a 30s timeout helps us unblock the stall non-blocking OpenFifo goroutines and fail loudly.

@fuweid
Copy link
Copy Markdown
Member

fuweid commented Jan 23, 2019

I think the change is reasonable because the fifo non-blocking goroutine is not in the request scope. SGTM.

@Random-Liu I see that exec process still uses the request context. do we need to update it too?

https://github.com/containerd/containerd/blob/365b163faf9be9da99f22c10a8295286c5229ae1/runtime/v1/linux/proc/exec.go#L212-L220

@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Jan 23, 2019

@fuweid Hm, actually it seems like a bug to me. We don't cancel the context in the regular code path. And although there can only be one Create, there can be many execs at the same time.

Say we run 1000 short-live execs in a container one by one in 30s, there will be 1000 goroutines running at the same time spawned by the timeout context.

I really think we should address containerd/fifo#18 then. @crosbymichael

@Random-Liu Random-Liu force-pushed the fix-stdin-close branch 2 times, most recently from 59f1368 to cadb6a4 Compare January 23, 2019 03:11
@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Jan 23, 2019

I updated the PR for the issue mentioned in #2944 (comment).

The new change:

If we are ok with this approach, we should also fix all the cherry-picks of #2877 because of #2944 (comment)

@estesp
Copy link
Copy Markdown
Member

estesp commented Jan 23, 2019

Just FYI; now that #2948 is merged, you can drop commit 9f669c91bd3740d3bb81f7df115ecbb89e3ac355 from this PR (well, assuming you can easily rebase on master)

Comment thread script/setup/install-dev-tools Outdated
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.

You can remove this now and rebase

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.

Done

@cpuguy83
Copy link
Copy Markdown
Member

Can you update the commit message to include why this is being done?
Otherwise changes seem correct, we don't want to bind the non-blocking opens to the request lifecycle.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@Random-Liu
Copy link
Copy Markdown
Member Author

Can you update the commit message to include why this is being done?

Done.

@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.

Containerd Kubernetes e2e test is broken flaky CRI test: [AfterEach] runtime should support attach [Conformance]

7 participants