{"action":"created","issue":{"url":"https://api.github.com/repos/hyperhq/runv/issues/196","repository_url":"https://api.github.com/repos/hyperhq/runv","labels_url":"https://api.github.com/repos/hyperhq/runv/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/hyperhq/runv/issues/196/comments","events_url":"https://api.github.com/repos/hyperhq/runv/issues/196/events","html_url":"https://github.com/hyperhq/runv/pull/196","id":150800325,"number":196,"title":"Fix panic when ctr exec contains no command","user":{"login":"WeiZhang555","id":1203611,"avatar_url":"https://avatars.githubusercontent.com/u/1203611?v=3","gravatar_id":"","url":"https://api.github.com/users/WeiZhang555","html_url":"https://github.com/WeiZhang555","followers_url":"https://api.github.com/users/WeiZhang555/followers","following_url":"https://api.github.com/users/WeiZhang555/following{/other_user}","gists_url":"https://api.github.com/users/WeiZhang555/gists{/gist_id}","starred_url":"https://api.github.com/users/WeiZhang555/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeiZhang555/subscriptions","organizations_url":"https://api.github.com/users/WeiZhang555/orgs","repos_url":"https://api.github.com/users/WeiZhang555/repos","events_url":"https://api.github.com/users/WeiZhang555/events{/privacy}","received_events_url":"https://api.github.com/users/WeiZhang555/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-25T09:24:40Z","updated_at":"2016-04-25T09:45:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hyperhq/runv/pulls/196","html_url":"https://github.com/hyperhq/runv/pull/196","diff_url":"https://github.com/hyperhq/runv/pull/196.diff","patch_url":"https://github.com/hyperhq/runv/pull/196.patch"},"body":"Normal exec should be `ctr exec --id xxx --pid xxx command`, if user\r\nforget to input command, runv-containerd panics.\r\n\r\nSigned-off-by: Zhang Wei <zhangwei555@huawei.com>\r\n\r\nPart of panic log:\r\n```\r\npanic: runtime error: index out of range\r\n\r\ngoroutine 38 [running]:\r\ngithub.com/hyperhq/runv/hypervisor.stateRunning(0xc820284120, 0x7f64e419d218, 0xc820301360)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/hypervisor/vm_states.go:716 +0x1c08\r\ngithub.com/hyperhq/runv/hypervisor.(*VmContext).loop(0xc820284120)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/hypervisor/hypervisor.go:30 +0x4c1\r\ngithub.com/hyperhq/runv/hypervisor.VmLoop(0xc820226b90, 0xd, 0xc82024c300, 0xc82024c360, 0xc82023eaf0)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/hypervisor/hypervisor.go:49 +0x1e9\r\ncreated by github.com/hyperhq/runv/hypervisor.(*Vm).Launch\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/hypervisor/vm.go:51 +0x19e\r\n\r\ngoroutine 1 [chan receive]:\r\nmain.daemon(0xc82010f860, 0x24, 0xc820138aa0, 0x14, 0xc820138ac0, 0x15, 0xc820138ae0, 0x1f, 0x0, 0x0)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/containerd/main.go:141 +0x3f2\r\nmain.main.func1(0xc8200d8780)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/containerd/main.go:115 +0x513\r\ngithub.com/codegangsta/cli.(*App).Run(0xc82008ef20, 0xc82000a120, 0x6, 0x6, 0x0, 0x0)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/Godeps/_workspace/src/github.com/codegangsta/cli/app.go:201 +0x13d8\r\nmain.main()\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/containerd/main.go:120 +0xe6\r\n\r\ngoroutine 17 [syscall, locked to thread]:\r\nruntime.goexit()\r\n\t/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1\r\n\r\ngoroutine 5 [syscall]:\r\nos/signal.loop()\r\n\t/usr/local/go/src/os/signal/signal_unix.go:22 +0x18\r\ncreated by os/signal.init.1\r\n\t/usr/local/go/src/os/signal/signal_unix.go:28 +0x37\r\n\r\ngoroutine 9 [chan receive]:\r\ngithub.com/golang/glog.(*loggingT).flushDaemon(0xf84260)\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/Godeps/_workspace/src/github.com/golang/glog/glog.go:882 +0x67\r\ncreated by github.com/golang/glog.init.1\r\n\t/home/darcy/gocode/src/github.com/hyperhq/runv/Godeps/_workspace/src/github.com/golang/glog/glog.go:410 +0x297\r\n\r\ngoroutine 10 [select, locked to thread]:\r\nruntime.gopark(0xb8c938, 0xc820029728, 0xa72340, 0x6, 0x18, 0x2)\r\n\t/usr/local/go/src/runtime/proc.go:185 +0x163\r\nruntime.selectgoImpl(0xc820029728, 0x0, 0x18)\r\n\t/usr/local/go/src/runtime/select.go:392 +0xa64\r\nruntime.selectgo(0xc820029728)\r\n\t/usr/local/go/src/runtime/select.go:212 +0x12\r\nruntime.ensureSigM.func1()\r\n\t/usr/local/go/src/runtime/signal1_unix.go:227 +0x353\r\nruntime.goexit()\r\n\t/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1\r\n\r\n    ...\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/hyperhq/runv/issues/comments/214237818","html_url":"https://github.com/hyperhq/runv/pull/196#issuecomment-214237818","issue_url":"https://api.github.com/repos/hyperhq/runv/issues/196","id":214237818,"user":{"login":"WeiZhang555","id":1203611,"avatar_url":"https://avatars.githubusercontent.com/u/1203611?v=3","gravatar_id":"","url":"https://api.github.com/users/WeiZhang555","html_url":"https://github.com/WeiZhang555","followers_url":"https://api.github.com/users/WeiZhang555/followers","following_url":"https://api.github.com/users/WeiZhang555/following{/other_user}","gists_url":"https://api.github.com/users/WeiZhang555/gists{/gist_id}","starred_url":"https://api.github.com/users/WeiZhang555/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeiZhang555/subscriptions","organizations_url":"https://api.github.com/users/WeiZhang555/orgs","repos_url":"https://api.github.com/users/WeiZhang555/repos","events_url":"https://api.github.com/users/WeiZhang555/events{/privacy}","received_events_url":"https://api.github.com/users/WeiZhang555/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T09:45:08Z","updated_at":"2016-04-25T09:45:08Z","body":"Reproduce steps:\r\n```\r\n$ sudo ctr --address unix:///run/runv-containerd/containerd.sock containers start busybox /tmp/busybox-runv/\r\n\r\n$  sudo ctr --address unix:///run/runv-containerd/containerd.sock containers exec --pid busybox-exec --id busybox \r\n```\r\n\r\nNote that correct exec should be:\r\n```\r\n$  sudo ctr --address unix:///run/runv-containerd/containerd.sock containers exec --pid busybox-exec --id busybox  sh\r\n```"}}