Env lost when call createcontainers for different pod with the same image by high concurrency
Description
Steps to reproduce the issue:
- Create mutiple pods with the same image but different envs in container spec on the one node at the same time for high concurrency
- (Maybe it is hard to reproduce, but if the scale of the cluster is too big, the probability of appearance is considerable)
Describe the results you received:
The first few envs of the previous container is overlapped by the next container env of the other pods with some probability if the two container has the same image and created at the very near same time for a high concurrency.
Describe the results you expected:
The different container from the relative pods has the different env.
Output of containerd --version:
containerd 1.4.3
Any other relevant information:
container_create_linux.go#L164
The root cause is append to the same env slice object for different containers
env := imageConfig.Env
for _, e := range config.GetEnvs() {
env = append(env, e.GetKey()+"="+e.GetValue())
}
Env lost when call createcontainers for different pod with the same image by high concurrency
Description
Steps to reproduce the issue:
Describe the results you received:
The first few envs of the previous container is overlapped by the next container env of the other pods with some probability if the two container has the same image and created at the very near same time for a high concurrency.
Describe the results you expected:
The different container from the relative pods has the different env.
Output of
containerd --version:containerd 1.4.3
Any other relevant information:
container_create_linux.go#L164
The root cause is append to the same env slice object for different containers