kubernetes/pkg/kubelet/kuberuntime
Kubernetes Submit Queue 0955f3602e Merge pull request #50381 from sczizzo/bugfix-issue-47800
Automatic merge from submit-queue (batch tested with PRs 50381, 51307, 49645, 50995, 51523)

Bugfix: Use local JSON log buffer in parseDockerJSONLog.

**What this PR does / why we need it**:
The issue described in #47800 is due to a race condition in `ReadLogs`: Because the JSON log buffer (`dockerJSONLog`) is package-scoped, any two goroutines modifying the buffer could race and overwrite the other's changes. In particular, one goroutine could unmarshal a JSON log line into the buffer, then another goroutine could `Reset()` the buffer, and the resulting `Stream` would be empty (`""`). This empty `Stream` is caught in a `case` block and raises an `unexpected stream type` error.

This PR creates a new buffer for each execution of `parseDockerJSONLog`, so each goroutine is guaranteed to have a local instance of the buffer.

**Which issue this PR fixes**: fixes #47800

**Release note**:
```release-note
Fixed an issue (#47800) where `kubectl logs -f` failed with `unexpected stream type ""`.
```
2017-09-01 16:33:56 -07:00
..
BUILD Revert "CPU manager wiring and none policy" 2017-09-01 18:17:36 +02:00
doc.go cmd/kubelet 2016-11-23 15:53:09 -08:00
fake_kuberuntime_manager.go Revert "CPU manager wiring and none policy" 2017-09-01 18:17:36 +02:00
helpers_test.go follow our go code style: error->err 2017-07-07 09:34:38 +08:00
helpers.go Rename runtime/default to docker default 2017-08-13 15:42:15 +08:00
instrumented_services_test.go Improving test coverage for kubelet/kuberuntime. 2017-06-01 09:43:15 +02:00
instrumented_services.go add UpdateContainerResources function to CRI 2017-07-31 20:47:56 -05:00
kuberuntime_container_test.go Do not try run preStop hook when the gracePeriod is 0 2017-08-03 07:57:21 +05:30
kuberuntime_container.go Revert "CPU manager wiring and none policy" 2017-09-01 18:17:36 +02:00
kuberuntime_gc_test.go run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
kuberuntime_gc.go Update CRI references 2017-06-09 10:16:40 +08:00
kuberuntime_image_test.go run hack/update-all 2017-06-22 11:31:03 -07:00
kuberuntime_image.go run hack/update-all 2017-06-22 11:31:03 -07:00
kuberuntime_logs_test.go run hack/update-all 2017-06-22 11:31:03 -07:00
kuberuntime_logs.go Use local JSON log buffer in parseDockerJSONLog. 2017-08-09 12:41:15 -04:00
kuberuntime_manager_test.go Refactor kuberuntime test case with sets.String 2017-08-22 19:43:18 +08:00
kuberuntime_manager.go Revert "CPU manager wiring and none policy" 2017-09-01 18:17:36 +02:00
kuberuntime_sandbox_test.go run hack/update-all 2017-06-22 11:31:03 -07:00
kuberuntime_sandbox.go Support seccomp profile from container's security context 2017-08-13 15:42:15 +08:00
labels_test.go run hack/update-all 2017-06-22 11:31:03 -07:00
labels.go run hack/update-all 2017-06-22 11:31:03 -07:00
legacy_test.go Move legacy log symlink to kuberuntime 2017-05-05 11:48:08 -07:00
legacy.go Move legacy log symlink to kuberuntime 2017-05-05 11:48:08 -07:00
security_context_test.go run hack/update-all 2017-06-22 11:31:03 -07:00
security_context.go Support seccomp profile from container's security context 2017-08-13 15:42:15 +08:00