juju storage filesystem list panics and dumps stack trace

Bug #1515736 reported by Matt Bruzek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
High
@les

Bug Description

Using juju 1.26-alpha1-vivid-amd64

I was writing documentation about the storage feature in Juju and found a command that panics and dumps the golang stack trace. If this is not a valid command juju should print out the usage and exit.

mbruzek@warhorse:/tmp/precise/postgresql$ juju storage filesystem list
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x6a5173]

goroutine 16 [running]:
runtime.panic(0x1f2c440, 0x34a0f53)
        /usr/lib/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/juju/juju/cmd/juju/storage.(*filesystemListCommand).Run(0xc20814d180, 0xc20820b720, 0x0, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/juju/cmd/juju/storage/filesystemlist.go:78 +0x163
github.com/juju/juju/cmd/envcmd.(*environCommandWrapper).Run(0xc208160e40, 0xc20820b720, 0x0, 0x0)
        <autogenerated>:62 +0x5f
github.com/juju/juju/cmd/envcmd.(*baseCommandWrapper).Run(0xc20815cdc0, 0xc20820b720, 0x0, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/juju/cmd/envcmd/base.go:108 +0x98
github.com/juju/cmd.(*SuperCommand).Run(0xc208053e00, 0xc20820b720, 0x0, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/cmd/supercommand.go:442 +0x577
github.com/juju/cmd.(*SuperCommand).Run(0xc208053b00, 0xc20820b720, 0x0, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/cmd/supercommand.go:442 +0x577
github.com/juju/cmd.(*SuperCommand).Run(0xc208052000, 0xc20820b720, 0x0, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/cmd/supercommand.go:442 +0x577
github.com/juju/cmd.Main(0x7fafc0823ef0, 0xc208052000, 0xc20820b720, 0xc20800e010, 0x3, 0x3, 0x0)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/cmd/cmd.go:279 +0x2d9
github.com/juju/juju/cmd/juju/commands.Main(0xc20800e000, 0x4, 0x4)
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/juju/cmd/juju/commands/main.go:72 +0x4ba
main.main()
        /build/juju-core-u1Izl6/juju-core-1.26-alpha1/src/github.com/juju/juju/cmd/juju/main.go:15 +0x44

goroutine 19 [finalizer wait]:
runtime.park(0x412f90, 0x34a90d0, 0x34a51a9)
        /usr/lib/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x34a90d0, 0x34a51a9)
        /usr/lib/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
        /usr/lib/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
        /usr/lib/go/src/pkg/runtime/proc.c:1445

goroutine 22 [syscall]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 33 [syscall]:
runtime.goexit()
        /usr/lib/go/src/pkg/runtime/proc.c:1445

- - - - - -

Please let me know what log files (if any) that you need to fix this problem. Thanks!

Tags: 2.0-count
Matt Bruzek (mbruzek)
description: updated
Revision history for this message
Cheryl Jennings (cherylj) wrote :

I can see this is because of these lines:

 70 if api == nil {
 71 api, err := c.NewStorageAPI()
 72 if err != nil {
 73 return err
 74 }
 75 defer api.Close()
 76 }

Since ":=" is used on line 71, api and err are local to that if statement. It should just be "=".

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
milestone: none → 1.26-alpha2
no longer affects: juju-core/1.25
Ian Booth (wallyworld)
Changed in juju-core:
assignee: nobody → @les (alesstimec)
Revision history for this message
Cheryl Jennings (cherylj) wrote :

This has been fixed as part of PR: https://github.com/juju/juju/pull/3702

Changed in juju-core:
status: Triaged → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
tags: added: 2.0-count
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.