Change:
return context.Background() } <ins> // TestConcurrentlyCreateAndDeleteContainers is a regression test for #93771, which ensures // kubelet would not panic on concurrent writes to `dockerService.containerCleanupInfos`. func TestConcurrentlyCreateAndDeleteContainers(t *testing.T) { ds, _, _ := newTestDockerService() podName, namespace := "foo", "bar" containerName, image := "sidecar", "logger" const count = 20 configs := make([]*runtimeapi.ContainerConfig, 0, count) sConfigs := make([]*runtimeapi.PodSandboxConfig, 0, count) for i := 0; i < count; i++ { s := makeSandboxConfig(fmt.Sprintf("%s%d", podName, i), fmt.Sprintf("%s%d", namespace, i), fmt.Sprintf("%d", i), 0) labels := map[string]string{"concurrent-test": fmt.Sprintf("label%d", i)} c := makeContainerConfig(s, fmt.Sprintf("%s%d", containerName, i), fmt.Sprintf("%s:v%d", image, i), uint32(i), labels, nil) sConfigs = append(sConfigs, s) configs = append(configs, c) } containerIDs := make(chan string, len(configs)) // make channel non-blocking to simulate concurrent containers creation var ( creationWg sync.WaitGroup deletionWg sync.WaitGroup ) creationWg.Add(len(configs)) go func() { creationWg.Wait() close(containerIDs) }() for i := range configs { go func(i int) { defer creationWg.Done() // We don't care about the sandbox id; pass a bogus one. sandboxID := fmt.Sprintf("sandboxid%d", i) req := &runtimeapi.CreateContainerRequest{PodSandboxId: sandboxID, Config: configs[i], SandboxConfig: sConfigs[i]} createResp, err := ds.CreateContainer(getTestCTX(), req) if err != nil { t.Errorf("CreateContainer: %v", err) return } containerIDs <- createResp.ContainerId }(i) } for containerID := range containerIDs { deletionWg.Add(1) go func(id string) { defer deletionWg.Done() _, err := ds.RemoveContainer(getTestCTX(), &runtimeapi.RemoveContainerRequest{ContainerId: id}) if err != nil { t.Errorf("RemoveContainer: %v", err) } }(containerID) } deletionWg.Wait() } </ins> // TestListContainers creates several containers and then list them to check // whether the correct metadatas, states, and labels are returned. func TestListContainers(t *testing.T) {

Discussion:
What happened: Windows kubelet panic occasionally on nodes which have high volume of pods run and delete. Full logs: Preliminary investigate result: How to reproduce it (as minimally and precisely as possible): Run high volume of pods and delete them when they completed in Windows nodes. Environment: Kubernetes version (use ): 1.17.7 Cloud provider or hardware configuration: Azure AKS OS (e.g: ): Windows Server 2019 Kernel (e.g. ): 10.0..1282
/assign I would like to give this a shot.
/remove-sig windows I think this is not a windows specific problem. /sig node /area kubelet
Hi! Thanks for your report, I have filed to address this issue.
This issue is a bit urgent for our situation, it occurs every few days in production clusters. Seems the PR is pending a few days, is it possible to increase the priority to merge it trunk and 1.17/1.18 branch? Thanks
I understand how urgent this issue is, but I am not privileged to do anything further :(
Do you know anyone who can help?
looks like a simple fix, add a lock for , I could help.
There is already a fix by , the problem is the PR is pending, not sure if you or someone can increase the priority to merge it trunk and 1.17/1.18 branch asap. Our AKS clusters are affecting by this frequently.
Thanks guys.