aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.51k stars 1.17k forks source link

Crash due to Gotty.(*TermInfo).GetAttribute #184

Closed alexaandru closed 6 years ago

alexaandru commented 6 years ago

Hello,

I just downloaded the latest sam version (0.2.2) created a template.yaml as instructed in the documentation and attempted to start sam local start-api. The result is this for any of {xterm-256color,urxvt,rxvt,xterm,ansi} TERM values (tried different terminals hoping Gotty would be able to handle any, but it wasn't):

$ sam local start-api
2017/10/30 18:01:10 Connected to Docker 1.32
2017/10/30 18:01:10 Runtime image missing, will pull....
2017/10/30 18:01:10 Fetching lambci/lambda:python2.7 image for python2.7 runtime...
python2.7: Pulling from lambci/lambda

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

goroutine 1 [running]:
github.com/awslabs/aws-sam-local/vendor/github.com/Nvveen/Gotty.(*TermInfo).GetAttribute(0x0, 0xc769fe, 0x3, 0xc4204f3690, 0x0, 0xc4204e2000, 0xc42052f250)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/Nvveen/Gotty/gotty.go:93 +0x131
github.com/awslabs/aws-sam-local/vendor/github.com/Nvveen/Gotty.(*TermInfo).Parse(0x0, 0xc769fe, 0x3, 0xc4204f3690, 0x1, 0x1, 0xc42052f2f0, 0x4ba735, 0xc4200e40c0, 0xc420024150)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/Nvveen/Gotty/parser.go:42 +0x5a
github.com/awslabs/aws-sam-local/vendor/github.com/docker/docker/pkg/jsonmessage.cursorUp(0x127c640, 0xc42000e020, 0x127b280, 0x0, 0x1)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:147 +0xe7
github.com/awslabs/aws-sam-local/vendor/github.com/docker/docker/pkg/jsonmessage.DisplayJSONMessagesStream(0x127c000, 0xc42045c840, 0x127c640, 0xc42000e020, 0x2, 0x1, 0x0, 0x0, 0x0)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:266 +0x3a1
main.NewRuntime(0xc76475, 0x1, 0xc42023df38, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42046aa20, ...)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/runtime.go:191 +0xae4
main.start(0xc4202ae780)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/start.go:80 +0x802
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.HandleAction(0xaf5da0, 0xca1a88, 0xc4202ae780, 0xc420482300, 0x0)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/app.go:487 +0x7c
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.Command.Run(0xc7a599, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc9f759, 0x3c9, 0x0, ...)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/command.go:207 +0xb72
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.(*App).RunAsSubcommand(0xc4204e4340, 0xc420362000, 0x0, 0x0)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/app.go:374 +0xacc
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.Command.startApp(0xc77b34, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc9bd82, 0x47, 0x0, ...)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/command.go:293 +0x8a3
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.Command.Run(0xc77b34, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc9bd82, 0x47, 0x0, ...)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/command.go:93 +0x14c7
github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.(*App).Run(0xc4200016c0, 0xc420010330, 0x3, 0x3, 0x0, 0x0)
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/app.go:250 +0x7d0
main.main()
        /home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/main.go:370 +0x23e4
alexaandru commented 6 years ago

It worked if I pulled the images manually (docker run lambci/lambda) :)

PaulMaddox commented 6 years ago

Hi,

Can you give a bit more detail around what OS you're running? e.g. cat /etc/lsb-release would help.

alexaandru commented 6 years ago

Hello,

Sure:

$ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 17.3 Rosa
Release:    17.3
Codename:   rosa

Initially I tried it from VS Code builtin terminal, then from urxvt, gnome-console and xterm and they all crashed the exact same way. Then I ran:

docker run lambci/lambda
docker run lambci/lambda:python2.7

and it worked. Docker version is 17.09.0-ce. Pulling the images manually worked as expected/no error.

alexaandru commented 6 years ago

This seems related: https://github.com/docker/for-mac/issues/1515 if not the same issue.

sanathkr commented 6 years ago

Not relevant anymore since v0.3.0 is written in Python