fission / fission-workflows

Workflows for Fission: Fast, reliable and lightweight function composition for serverless functions
Apache License 2.0
361 stars 40 forks source link

getting workflow invocation via the CLI panics #240

Open grounded042 opened 5 years ago

grounded042 commented 5 years ago

Fission / Workflows Version

$ fission -v
client:
  fission/core:
    gitcommit: 045ab734c6bd04cdc07ebd80f05874c7122ffd18
    builddate: 2018-12-13T07:56:27Z
    version: 1.0-rc1
  workflows:
    gitcommit: ""
    builddate: ""
    version: 0.6.0
server:
  fission/core:
    gitcommit: 12f6d91224c95e9e60da4adddd9922a273ace060
    builddate: 2019-01-14T17:02:51Z
    version: 1.0-rc2

k8s Version

v1.13.2

Commands Run

after getting the fortunewhale example setup

$ curl ${FISSION_ROUTER}/fortunewhale
...fortunewhale output...
$ fission-workflows wfi get
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x31f29e]

goroutine 1 [running]:
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd304c0, 0x13492d20, 0x199, 0x1383e320, 0x44, 0x50, 0x1356cc60, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:769 +0x35ce
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd952e0, 0x1352cbf0, 0x196, 0x1383e320, 0x44, 0x50, 0x1356cc60, 0xc95128, 0x38)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xcdacc0, 0x1352cbf0, 0x199, 0x13725220, 0x4e, 0x50, 0x1356cc00, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd98620, 0x1352cbe8, 0x196, 0x13725220, 0x4e, 0x50, 0x1356cc00, 0x196, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xc7ec40, 0x137ad7c8, 0x195, 0x137ca700, 0x677, 0x700, 0x1356cb40, 0xd491e2, 0x84)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:1039 +0x11f0
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd04cc0, 0x137ad7c0, 0x199, 0x137ca000, 0x6b6, 0x700, 0x1356ca80, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd5a240, 0x138260b4, 0x196, 0x137ca000, 0x6b6, 0x700, 0x1356ca80, 0xc8e1f1, 0x36)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137f2050, 0xd04c40, 0x138260b0, 0x199, 0x135b1300, 0x1085, 0x1300, 0x0, 0xb546, 0xb0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).UnmarshalNext(0x137f2050, 0x135ac210, 0x101a530, 0x138260b0, 0xf01, 0x137f2050)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:669 +0x158
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).Unmarshal(0x137f2050, 0x1012e10, 0x137a4180, 0x101a530, 0x138260b0, 0x2c64d0, 0x13492164)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:680 +0x58
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.Unmarshal(0x1012e10, 0x137a4180, 0x101a530, 0x138260b0, 0x13492100, 0x1012e10)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:694 +0x49
github.com/fission/fission-workflows/pkg/apiserver/httpclient.fromJSON(0x1012e10, 0x137a4180, 0x101a530, 0x138260b0, 0x137a4180, 0x1361e3c0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/httpclient.go:36 +0x33
github.com/fission/fission-workflows/pkg/apiserver/httpclient.callWithJSON(0x1023040, 0x134be004, 0xde45d6, 0x3, 0x1382c000, 0x63, 0x0, 0x0, 0x101a530, 0x138260b0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/httpclient.go:97 +0x3bf
github.com/fission/fission-workflows/pkg/apiserver/httpclient.(*InvocationAPI).Get(0x13760210, 0x1023040, 0x134be004, 0x1382a090, 0x27, 0x0, 0x41635, 0x4f3a0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/invocation.go:50 +0xe2
main.invocationsList(0x10130d0, 0x134a0008, 0x13760210, 0x361e1488, 0xbf0e4f4c, 0xd658a23e, 0xfffffcb9, 0x1abcc40)
        src/github.com/fission/fission-workflows/cmd/fission-workflows/invocation.go:187 +0xca
main.glob..func4(0x1349d040, 0xdeadd7, 0x9)
        src/github.com/fission/fission-workflows/cmd/fission-workflows/invocation.go:39 +0xfd
main.commandContext.func1(0x1349d040, 0x0, 0x1349d040)
        src/github.com/fission/fission-workflows/cmd/fission-workflows/main.go:138 +0x60
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.HandleAction(0xc55040, 0x1370b110, 0x1349d040, 0x1362b600, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:485 +0x9c
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.Run(0xde47b3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe01052, 0x1d, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:193 +0x8d5
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0x134ff2b0, 0x1349ce60, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:374 +0x6a3
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.startApp(0xdeb99c, 0xa, 0x0, 0x0, 0x1ab0e20, 0x2, 0x2, 0xe09ec7, 0x24, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:280 +0x5e6
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.Run(0xdeb99c, 0xa, 0x0, 0x0, 0x1ab0e20, 0x2, 0x2, 0xe09ec7, 0x24, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:79 +0x1009
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.(*App).Run(0x134ff1e0, 0x13490040, 0x3, 0x4, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:250 +0x5b2
main.main()
        src/github.com/fission/fission-workflows/cmd/fission-workflows/main.go:79 +0x436

Expected Output

It should output a list of invocations

Other Notes

I poked around a little bit and it seems like it gets the list of invocations, but then errors trying to get the details of one. I was able to verify this by running $ fission-workflows wfi get wi-31ad7292-51ec-4593-bd71-73e903771ec8 which returns a similar error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x31f29e]

goroutine 1 [running]:
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd304c0, 0x13670480, 0x199, 0x13846140, 0x44, 0x50, 0x137de960, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:769 +0x35ce
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd952e0, 0x137fa228, 0x196, 0x13846140, 0x44, 0x50, 0x137de960, 0xc95128, 0x38)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xcdacc0, 0x137fa228, 0x199, 0x13846000, 0x4e, 0x50, 0x137de8a0, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd98620, 0x137fa220, 0x196, 0x13846000, 0x4e, 0x50, 0x137de8a0, 0x196, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xc7ec40, 0x137f0d68, 0x195, 0x13840700, 0x677, 0x700, 0x137de7e0, 0xd491e2, 0x84)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:1039 +0x11f0
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd04cc0, 0x137f0d60, 0x199, 0x13840000, 0x6b6, 0x700, 0x137de6c0, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd5a240, 0x137b03c4, 0x196, 0x13840000, 0x6b6, 0x700, 0x137de6c0, 0xc8e1f1, 0x36)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:719 +0x238
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).unmarshalValue(0x137dc030, 0xd04c40, 0x137b03c0, 0x199, 0x135a2600, 0x1085, 0x1300, 0x0, 0xb546, 0xb0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:940 +0x67b
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).UnmarshalNext(0x137dc030, 0x136c4160, 0x101a530, 0x137b03c0, 0xf01, 0x137dc030)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:669 +0x158
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.(*Unmarshaler).Unmarshal(0x137dc030, 0x1012e10, 0x136701e0, 0x101a530, 0x137b03c0, 0x2c64d0, 0x13448194)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:680 +0x58
github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb.Unmarshal(0x1012e10, 0x136701e0, 0x101a530, 0x137b03c0, 0x13448100, 0x1012e10)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go:694 +0x49
github.com/fission/fission-workflows/pkg/apiserver/httpclient.fromJSON(0x1012e10, 0x136701e0, 0x101a530, 0x137b03c0, 0x136701e0, 0x137055c0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/httpclient.go:36 +0x33
github.com/fission/fission-workflows/pkg/apiserver/httpclient.callWithJSON(0x1023340, 0x1366ee60, 0xde45d6, 0x3, 0x13823730, 0x63, 0x0, 0x0, 0x101a530, 0x137b03c0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/httpclient.go:97 +0x3bf
github.com/fission/fission-workflows/pkg/apiserver/httpclient.(*InvocationAPI).Get(0x1374f290, 0x1023340, 0x1366ee60, 0xbffff96e, 0x27, 0x1, 0x4d, 0xe09afc)
        /Users/erwin/go/src/github.com/fission/fission-workflows/pkg/apiserver/httpclient/invocation.go:50 +0xe2
main.glob..func4(0x1366ee60, 0xdeadd7, 0x9)
        src/github.com/fission/fission-workflows/cmd/fission-workflows/invocation.go:43 +0x146
main.commandContext.func1(0x1366ee60, 0x0, 0x1366ee60)
        src/github.com/fission/fission-workflows/cmd/fission-workflows/main.go:138 +0x60
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.HandleAction(0xc55040, 0x136daab0, 0x1366ee60, 0x13671200, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:485 +0x9c
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.Run(0xde47b3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe01052, 0x1d, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:193 +0x8d5
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0x135b8dd0, 0x1366ec80, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:374 +0x6a3
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.startApp(0xdeb99c, 0xa, 0x0, 0x0, 0x1ab0e20, 0x2, 0x2, 0xe09ec7, 0x24, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:280 +0x5e6
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.Command.Run(0xdeb99c, 0xa, 0x0, 0x0, 0x1ab0e20, 0x2, 0x2, 0xe09ec7, 0x24, 0x0, ...)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/command.go:79 +0x1009
github.com/fission/fission-workflows/vendor/github.com/urfave/cli.(*App).Run(0x135b8d00, 0x134360c0, 0x4, 0x4, 0x0, 0x0)
        /Users/erwin/go/src/github.com/fission/fission-workflows/vendor/github.com/urfave/cli/app.go:250 +0x5b2
main.main()
        src/github.com/fission/fission-workflows/cmd/fission-workflows/main.go:79 +0x436
erwinvaneyk commented 5 years ago

Hi @grounded042 - did you have any workflows/invocations created when executing these commands?

grounded042 commented 5 years ago

👋 If I run fission-workflows wfi get without any workflows/invocations created I don't get any errors. But as soon as I've run one or more workflows it gets the error.

erwinvaneyk commented 5 years ago

Thanks for the info @grounded042 ! I can look into it, unless you want to take a shot at it yourself 😉

grounded042 commented 5 years ago

If I've got some time I can take a look - I did briefly yesterday but ended up getting lost in protobuf world :)

erwinvaneyk commented 5 years ago

Ugh, the Protobuf is silly sometimes :) What is the version of the Fission Workflows deployment you were using? It might be that there is a diff in the Protobuf definitions between the CLI and the workflow engine builds that you are using. In that case there is not much that we can, other than outputting a more helpful error, and maybe add a warning to the CLI when there is a version mismatch.

grounded042 commented 5 years ago
$ fission-workflows version
client: {"Version":"0.6.0","GitDate":"2018-10-15T16:47:17Z","BuildDate":"2018-10-15T16:47:17Z","GitCommit":"78c053231958e0709e9a668a1557968d9a7ec46b"}
server: {"Version":"0.6.0","GitDate":"2018-10-15T16:47:17Z","BuildDate":"2018-10-15T16:47:17Z","GitCommit":"78c053231958e0709e9a668a1557968d9a7ec46b"}
grounded042 commented 5 years ago

@erwinvaneyk I was able to make some progress on this, but I'm not sure where to look to fix it. When it gets to reading the protobuf response into an object (https://github.com/fission/fission-workflows/blob/master/pkg/apiserver/httpclient/httpclient.go#L96) it panics because there is a null value in there. For example, this will reliably reproduce the problem:

package main

import (
    "bytes"
    "fmt"

    "github.com/fission/fission-workflows/pkg/types"
    "github.com/golang/protobuf/jsonpb"
)

func main() {
    fine := bytes.NewReader([]byte(`{"spec":{"inputs":{}}}`))
    willPanic := bytes.NewReader([]byte(`{"spec":{"inputs":{"default":{"value":{"@type":"types.fission.io/google.protobuf.BytesValue","value":null}}}}}`))

    fineResult := &types.WorkflowInvocation{}
    err := jsonpb.Unmarshal(fine, fineResult)
    if err != nil {
        fmt.Println("error unmarshaling the `fine` json protobuf:", err.Error())
        return
    }
    fmt.Println("fine:", fineResult)

    willPanicResult := &types.WorkflowInvocation{}
    err = jsonpb.Unmarshal(willPanic, willPanicResult)
    if err != nil {
        fmt.Println("error unmarshaling the `willPanic` json protobuf:", err.Error())
        return
    }

    fmt.Println("willPanic:", willPanicResult)
}

The willPanic variable in there is a small snippet of what I get back according to debugging and also when I hit http://<address>/proxy/workflows-apiserver/invocation/<invocation-id>

I'm assuming that whatever is marshaling that object to send it along is what needs to be fixed, but if I'm following things correctly it's just pulling that straight from the store and I didn't have the time to figure out what was putting that object there or how it marshaled it either.