Skip to content

Failing pod never times out #6504

Open
Open

Description

@duglin

In what area(s)?

/area autoscale

What version of Knative?

HEAD

Expected Behavior

When a pod fails to start properly it should eventually be terminated.

Actual Behavior

If an instance/pod fails to start and it is the first time the revision is starting a pod then the pod will eventually be terminated. But, if the first instance of the revision starts ok, then scales down to zero, if the next instance/pod that is created fails to start then the pod will continually crash-loop (which is expected) but it'll never be terminated and never goes away.

It seems like there should be consistency between a "first time pod" and a "2+ time pod" w.r.t. what happens when it crashes.

Steps to Reproduce the Problem

You can reproduce this by running this bash script:

#!/bin/bash

set -e
kubectl delete ksvc/bugsvc > /dev/null 2>&1 || true
kubectl delete ksvc/bugsvc2 > /dev/null 2>&1 || true

export CRASH=$(( $(date -u '+%s') + 120))

echo "Time now: ${now:15:5}
echo "Will die: ${CRASH}

kubectl apply -f - <<EOF
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: bugsvc
spec:
  template:
    spec:
      containers:
      - image: duglin/echo
        env:
          - name: CRASH
            value: ${CRASH}
EOF
sleep 10
URL=$(kubectl get ksvc/bugsvc -o custom-columns=URL:.status.url --no-headers)

echo "Send curl just to make sure it works"
curl $URL

echo "Wait for it to scale to zero"
while kubectl get pods | grep bugsvc ; do
  sleep 10
done

echo "Sleep for 2 minutes just to make sure we're past the crash time"
sleep 120

echo "Create bugsvc2 so it fails immediately"
kubectl apply -f - <<EOF
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: bugsvc2
spec:
  template:
    spec:
      containers:
      - image: duglin/echo
        env:
          - name: CRASH
            value: "true"
EOF
echo "Now curl bugsvc again to force it to scale up to 1"
curl $URL &

echo "Pods should be failing, but bugsvc2 will eventually vanish"
kubectl get pods -w

The image used will crash if it is started after the time (hour:min) of the CRASH env var. So, in the case of bugsvc we create the ksvc before CRASH time, let it scale down to zero, then hit it after CRASH time so that the pod fails. KnService bugsvc2 crashes immediately to show how the pod will be removed (for me after about 2 minutes) while bugsvc's pod seems to live forever (or at least a LOT longer).

Activity

  1. added
    kind/bug
    on Jan 12, 2020
  2. added this to the Serving 0.14.x milestone on Feb 26, 2020
  3. added
    area/API
    on May 27, 2020
  4. github-actions commented on Aug 25, 2020

    @github-actions

    This issue is stale because it has been open for 90 days with no
    activity. It will automatically close after 30 more days of
    inactivity. Reopen the issue with /reopen.Mark the issue as
    fresh by adding the comment /remove-lifecycle stale.

  5. added
    lifecycle/stale
    on Aug 25, 2020
  6. duglin commented on Aug 25, 2020

    @duglin
    Author

    /lifecycle frozen

  7. added
    lifecycle/frozen
    and removed
    lifecycle/stale
    on Aug 25, 2020
  8. 4 remaining items

  9. added
    triage/needs-user-input
    on Mar 22, 2021
  10. vagababov commented on Mar 22, 2021

    @vagababov
    Contributor

    /unassign

  11. evankanderson commented on Jun 23, 2021

    @evankanderson
    Member

    /help
    /remove-triage needs-user-input
    /triage accepted

  12. knative-prow-robot commented on Jun 23, 2021

    @knative-prow-robot
    Contributor

    @evankanderson:
    This request has been marked as needing help from a contributor.

    Please ensure the request meets the requirements listed here.

    If this request no longer meets these requirements, the label can be removed
    by commenting with the /remove-help command.

    Details

    In response to this:

    /help
    /remove-triage needs-user-input
    /triage accepted

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

  13. added
    triage/accepted
    help wanted
    and removed
    triage/needs-user-input
    on Jun 23, 2021
  14. duglin commented on Jun 24, 2021

    @duglin
    Author

    yes I believe it will live on even w/o requests

  15. modified the milestones: Needs Triage, Ice Box on Oct 6, 2021
  16. xtreme-vikram-yadav commented on Aug 21, 2023

    @xtreme-vikram-yadav

    I started looking into this issue. After going through the reproduction steps in the description, I observed that the pods get terminated eventually. I had written a small application on developer machine with similar behaviour(fails/panics after a couple of mins.) and I can still see pods getting terminated. It seems like this may not be an issue anymore.

  17. gabo1208 commented on Oct 27, 2023

    @gabo1208
    Contributor

    /assign

  18. gabo1208 commented on Nov 6, 2023

    @gabo1208
    Contributor

    related to #13677 @jsanin-vmw
    Digging a bit better is related but not solved by #13677 so let's keep it separated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/APIarea/autoscalehelp wantedkind/buglifecycle/frozentriage/accepted

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions