Bug 1340784 - Meet panic "slice bounds out of range" when oc describe upon build that has no git commit id
Summary: Meet panic "slice bounds out of range" when oc describe upon build that has n...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Build
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: ---
Assignee: Victor Ionut Palade
QA Contact: Wenjing Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-30 09:35 UTC by Xingxing Xia
Modified: 2016-09-19 13:49 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-19 13:49:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xingxing Xia 2016-05-30 09:35:09 UTC
Description of problem:
Meet panic "slice bounds out of range" when oc describe upon build that has no git commit, see below details

Version-Release number of selected component (if applicable):
oc v1.3.0-alpha.1-41-g681170a
As far as I tried, oc v1.1.6-169-gde5b801 reproduces but oc v1.1.3-631-g2d2d659 works

How reproducible:
Always

Steps to Reproduce:
1. oc login, create a project xxia-proj
2. Create a bc
$ oc new-build centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git

3. Trigger a new build which will has no git commit, e.g. mimic generic webhook:
1>
Get webhook URL:
$ oc describe bc ruby-hello-world
...
Webhook Generic:	https://<master>:8443/oapi/v1/namespaces/xxia-proj/buildconfigs/ruby-hello-world/webhooks/secret101/generic
...
2> Edit push-generic.json:
$ wget https://raw.githubusercontent.com/openshift/origin/master/pkg/build/webhook/generic/fixtures/push-generic.json
$ vi push-generic.json # modify as follows:
...
    "commit" : "",
...
3> Mimic webhook trigger:
$ curl -k -H "Content-Type: application/json" -d @push-generic.json https://<master>:8443/oapi/v1/namespaces/xxia-proj/buildconfigs/ruby-hello-world/webhooks/secret101/generic
# this will trigger a new build ruby-hello-world-2
4> Check builds
ruby-hello-world-1    Source    Git@e79d887    Complete   3 days ago      2m2s
ruby-hello-world-2    Source    Git            Complete   2 minutes ago   1m8s
4. oc describe build:
1> oc describe build ruby-hello-world-1
2> oc describe build ruby-hello-world-2

Actual results:
4.
1> Command succeeds
2> Command fails and throws out:
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/openshift/origin/pkg/cmd/cli/describe.describeBuildSpec(0xc208213d90, 0x7, 0x0, 0x0, 0xc20841d770, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_build/src/github.com/openshift/origin/pkg/cmd/cli/describe/describer.go:203 +0x200b
github.com/openshift/origin/pkg/cmd/cli/describe.func·021(0xc2085a3f00, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_build/src/github.com/openshift/origin/pkg/cmd/cli/describe/describer.go:148 +0x62c
github.com/openshift/origin/pkg/cmd/cli/describe.tabbedString(0xc20858f938, 0x0, 0x0, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_build/src/github.com/openshift/origin/pkg/cmd/cli/describe/helpers.go:29 +0x11d
github.com/openshift/origin/pkg/cmd/cli/describe.(*BuildDescriber).Describe(0xc2085c4a60, 0xc208509290, 0x9, 0x7fff966285c3, 0x12, 0x0, 0x0, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_build/src/github.com/openshift/origin/pkg/cmd/cli/describe/describer.go:154 +0x5a9
k8s.io/kubernetes/pkg/kubectl/cmd.RunDescribe(0xc2083cc5a0, 0x7f6820dd1390, 0xc20803a008, 0xc2084ea000, 0xc2085499e0, 0x2, 0x2, 0xc2084c7ce0, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go:138 +0xcff
k8s.io/kubernetes/pkg/kubectl/cmd.func·023(0xc2084ea000, 0xc2085499e0, 0x2, 0x2)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go:86 +0x6f
github.com/spf13/cobra.(*Command).execute(0xc2084ea000, 0xc208549840, 0x2, 0x2, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/github.com/spf13/cobra/command.go:572 +0x82f
github.com/spf13/cobra.(*Command).ExecuteC(0xc208227400, 0xc2084ea000, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/github.com/spf13/cobra/command.go:662 +0x4db
github.com/spf13/cobra.(*Command).Execute(0xc208227400, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/github.com/spf13/cobra/command.go:618 +0x3a
main.main()
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_build/src/github.com/openshift/origin/cmd/oc/oc.go:27 +0x175

goroutine 5 [chan receive]:
github.com/golang/glog.(*loggingT).flushDaemon(0x2ca1920)
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/github.com/golang/glog/glog.go:879 +0x78
created by github.com/golang/glog.init·1
	/builddir/build/BUILD/atomic-openshift-git-0.a2ee9db/_thirdpartyhacks/src/github.com/golang/glog/glog.go:410 +0x2a7

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/lib/golang/src/runtime/asm_amd64.s:2232 +0x1

goroutine 13 [syscall]:
os/signal.loop()
	/usr/lib/golang/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
	/usr/lib/golang/src/os/signal/signal_unix.go:27 +0x35

goroutine 33 [runnable]:
syscall.Syscall(0x0, 0x3, 0xc2085f0000, 0x2000, 0xffffffffffffffff, 0x0, 0xb)
	/usr/lib/golang/src/syscall/asm_linux_amd64.s:21 +0x5
syscall.read(0x3, 0xc2085f0000, 0x2000, 0x2000, 0x72, 0x0, 0x0)
	/usr/lib/golang/src/syscall/zsyscall_linux_amd64.go:867 +0x6e
syscall.Read(0x3, 0xc2085f0000, 0x2000, 0x2000, 0xe33, 0x0, 0x0)
	/usr/lib/golang/src/syscall/syscall_unix.go:136 +0x58
net.(*netFD).Read(0xc20845aa10, 0xc2085f0000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/fd_unix.go:238 +0x314
net.(*conn).Read(0xc20803a768, 0xc2085f0000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/net.go:121 +0xdc
crypto/tls.(*block).readFromUntil(0xc2084e0c60, 0x7f6820de6100, 0xc20803a768, 0x5, 0x0, 0x0)
	/usr/lib/golang/src/crypto/tls/conn.go:454 +0xe6
crypto/tls.(*Conn).readRecord(0xc208542840, 0x17, 0x0, 0x0)
	/usr/lib/golang/src/crypto/tls/conn.go:539 +0x2da
crypto/tls.(*Conn).Read(0xc208542840, 0xc2083cf000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/crypto/tls/conn.go:904 +0x166
net/http.noteEOFReader.Read(0x7f6820de6538, 0xc208542840, 0xc208336cb8, 0xc2083cf000, 0x1000, 0x1000, 0x180f460, 0x0, 0x0)
	/usr/lib/golang/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc2084312a0, 0xc2083cf000, 0x1000, 0x1000, 0xc2081b4000, 0x0, 0x0)
	<autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc208322300)
	/usr/lib/golang/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).Peek(0xc208322300, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/bufio/bufio.go:132 +0xf0
net/http.(*persistConn).readLoop(0xc208336c60)
	/usr/lib/golang/src/net/http/transport.go:842 +0xa4
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:660 +0xc9f

goroutine 34 [select]:
net/http.(*persistConn).writeLoop(0xc208336c60)
	/usr/lib/golang/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:661 +0xcbc


Expected results:
4.
2> Should succeed.

Additional info:

Comment 1 Victor Ionut Palade 2016-05-31 12:40:54 UTC
i took it, since i introduced the PR. will update with a fix asap.

Comment 2 Wenjing Zheng 2016-06-03 06:04:40 UTC
(In reply to Victor Ionut Palade from comment #1)
> i took it, since i introduced the PR. will update with a fix asap.

How is the bug status now?

Comment 3 Victor Ionut Palade 2016-06-03 06:24:54 UTC
(In reply to Wenjing Zheng from comment #2)
> (In reply to Victor Ionut Palade from comment #1)
> > i took it, since i introduced the PR. will update with a fix asap.
> 
> How is the bug status now?

it's fixed, but pending merge. our merge queue is acting up
pr is here:
https://github.com/openshift/origin/pull/9097

Comment 4 Victor Ionut Palade 2016-06-06 15:01:03 UTC
(In reply to Wenjing Zheng from comment #2)
> (In reply to Victor Ionut Palade from comment #1)
> > i took it, since i introduced the PR. will update with a fix asap.
> 
> How is the bug status now?

pr was merged, please have a look, should be fixed.

Comment 5 Wenjing Zheng 2016-06-07 03:28:50 UTC
Verified with below version, thanks!:
openshift v1.3.0-alpha.1-159-g93af6aa
kubernetes v1.3.0-alpha.1-331-g0522e63
etcd 2.3.0


Note You need to log in before you can comment on or make changes to this bug.