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

faas-containerd panics with a runtime error: index out of range #24

Open utsavanand2 opened 4 years ago

utsavanand2 commented 4 years ago

Expected Behaviour

I shoud be able to deploy my function with faas-cli

Current Behaviour

faas-containerd is crashing with an index out of range error

Screenshot 2020-01-11 at 1 29 11 AM

Steps to Reproduce (for bugs)

Followed the steps in the README.md

Your Environment

go version
go not installed

sudo /opt/cni/bin/bridge version
CNI bridge plugin v0.8.4

containerd -version
containerd github.com/containerd/containerd v1.3.2 ff48f57fc83a8c44cf4ad5d672424a98ba37ded6

uname -a
Linux faas 5.0.0-1028-gcp #29~18.04.1-Ubuntu SMP Thu Dec 19 19:04:05 UTC 2019 x86_64 
x86_64 x86_64 GNU/Linux

cat /etc/os-release
Screenshot 2020-01-11 at 1 34 15 AM
utsavanand2 commented 4 years ago

Derek add label: help-wanted

alexellis commented 4 years ago

@carlosedp cc

alexellis commented 4 years ago

What do you have on that line?

carlosedp commented 4 years ago

I believe replacing:

    defaultInterface := gocni.DefaultPrefix + "0"
    ip := &result.Interfaces[defaultInterface].IPConfigs[0].IP

With:

    ip, ipErr := getIP(DefaultBridgeName, int(task.Pid()))
    if ipErr != nil {
        serviceMap.Add(name, ip)
        serviceMap.Update()
    }

Might fix this, I'd like to know more about this.

@utsavanand2 can you list your interfaces with ip link?

alexellis commented 4 years ago

I added this patch to fix some of the error conditions. https://github.com/alexellis/faas-containerd/commit/b00ddadd6ef6d174d2b19dacb5d00667109d2f38

carlosedp commented 4 years ago

Fixed by #26. Can you retest @utsavanand2 ?

utsavanand2 commented 4 years ago

Sure @carlosedp 😄