alexellis / faas-containerd

containerd and CNI provider for OpenFaaS
https://blog.alexellis.io/faas-containerd-serverless-without-kubernetes/
MIT License
60 stars 10 forks source link

Containers with stopped tasks cannot be scaled up #27

Open carlosedp opened 4 years ago

carlosedp commented 4 years ago

If a container has it's task as "STOPPED", scaling it back generates an error and the task does not run.

Expected Behaviour

Have the task in RUNNING state.

Current Behaviour

Show function and it's container and task:

❯ faas-cli list
Function                        Invocations     Replicas
figlet1                         0               0

❯ sudo ctr -n openfaas-fn container ls
CONTAINER    IMAGE                                RUNTIME
figlet1      docker.io/functions/figlet:0.13.0    io.containerd.runc.v2

❯ sudo ctr -n openfaas-fn task ls
TASK       PID     STATUS
figlet1    6760    STOPPED

Try to scale it back to 1 replica:

❯ curl http://127.0.0.1:8081/system/scale-function/figlet1 -d '{"serviceName":"figlet1", "replicas": 1}'
cannot scale task for figlet1, error: cannot resume a stopped container: unknown

Generates error:

Jan 17 16:32:51 debian10 faas-containerd[6669]: 2020/01/17 16:32:51 Resolve: "figlet1"
Jan 17 16:32:51 debian10 faas-containerd[6669]: 2020/01/17 16:32:51 error with proxy request to: http://:8080, Post http://:8080: dial tcp :8080: connect: connection refused
Jan 17 16:32:56 debian10 faas-containerd[6669]: 2020/01/17 16:32:56 [Scale] request: {"serviceName":"figlet1", "replicas": 1}
Jan 17 16:32:56 debian10 faas-containerd[6669]: 2020/01/17 16:32:56 [Scale] cannot scale task for figlet1, error: cannot resume a stopped container: unknown

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

Latest built from persistence branch.

go version

containerd -version

uname -a

cat /etc/os-release
alexellis commented 4 years ago

Fixed - please retest with latest versions