Skip to content

Creating a pod has a probability of failure #2736

@wzshiming

Description

@wzshiming
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  namespace: default
spec:
  replicas: 10
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - args:
        - -c
        - sleep inf
        command:
        - /bin/sh
        image: busybox
        imagePullPolicy: IfNotPresent
        name: test
        ports:
        - containerPort: 4444
          name: test
          protocol: TCP
        resources:
          limits:
            cpu: 10m
            memory: 10Mi
          requests:
            cpu: 10m
            memory: 10Mi

image
image

image

This will not happen if remove the memory limit or change it to 100MI

It's the fault here

func retryingWriteFile(fd *os.File, data string) error {
for {
_, err := fd.Write([]byte(data))
if errors.Is(err, unix.EINTR) {
logrus.Infof("interrupted while writing %s to %s", data, fd.Name())
continue
}
return err
}
}

Maybe it's missing a condition check? unix.EBUSY

func retryingWriteFile(filename string, data []byte, perm os.FileMode) error {
	for {
		err := ioutil.WriteFile(filename, data, perm)
		if errors.Is(err, unix.EINTR) || errors.Is(err, unix.EBUSY) {
			logrus.Infof("interrupted while writing %s to %s", string(data), filename)
			continue
		}
		return err
	}
}

May I ask if this is a known problem? if not, I will try to fix it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions