juju deploy existing charm after upgrading gives nil pointer panic

Bug #1806331 reported by Christian Muirhead
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Simon Richardson

Bug Description

If I try to deploy a charm that already exists in the DB after upgrading from juju 2.4.7 to 2.5-beta3, I get a nil pointer error because the charm's LXDProfile is nil in the database. We need an upgrade step to add the field to existing charms so that calling Charms.CharmInfo works correctly for them. This probably needs to happen when the controller upgrades, rather than waiting for the model to be upgraded.

machine-0: 17:54:00 CRITICAL juju.rpc panic running request {MethodCaller:0xc0062ad8c0 transformErrors:0x1f2f970 hdr:{RequestId:5 Request:{Type:Charms Version:2 Id: Action:CharmInfo} Error: ErrorCode: Version:1}} with arg {URL:cs:~jameinel/ubuntu-lite-7}: runtime error: i
nvalid memory address or nil pointer dereference
goroutine 414796 [running]:
runtime/debug.Stack(0xc00603b708, 0x3070e20, 0x654f2d0)
        /snap/go/current/src/runtime/debug/stack.go:24 +0xa7
github.com/juju/juju/rpc.(*Conn).runRequest.func1(0xc00603bf30, 0x3129e40, 0xc00b1610a0, 0x199, 0xc000afde00, 0x3cc2200, 0xc00aa5fca0)
        /opt/go/src/github.com/juju/juju/rpc/server.go:547 +0xbe
panic(0x3070e20, 0x654f2d0)
        /snap/go/current/src/runtime/panic.go:513 +0x1b9
github.com/juju/juju/vendor/gopkg.in/juju/charm%2ev6.(*LXDProfile).Empty(...)
        /opt/go/src/github.com/juju/juju/vendor/gopkg.in/juju/charm.v6/lxdprofile.go:73
github.com/juju/juju/apiserver/facades/client/charms.(*API).CharmInfo(0xc00aa5ffc0, 0xc009e93500, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /opt/go/src/github.com/juju/juju/apiserver/facades/client/charms/client.go:100 +0x266
reflect.Value.call(0x31ba480, 0xc00aa5ffc0, 0x213, 0x3703085, 0x4, 0xc00aa5ffe0, 0x1, 0x1, 0x9fb2c1, 0x2f062c0, ...)
        /snap/go/current/src/reflect/value.go:447 +0x449
reflect.Value.Call(0x31ba480, 0xc00aa5ffc0, 0x213, 0xc00aa5ffe0, 0x1, 0x1, 0x1, 0x1, 0xc0004e6700)
        /snap/go/current/src/reflect/value.go:308 +0xa4
github.com/juju/juju/rpc/rpcreflect.newMethod.func8(0x3cea280, 0xc0062ad900, 0x31ba480, 0xc00aa5ffc0, 0x16, 0x3129e40, 0xc00b1610a0, 0x199, 0x42df32, 0xc000000000, ...)
        /opt/go/src/github.com/juju/juju/rpc/rpcreflect/type.go:344 +0x109
github.com/juju/juju/apiserver.(*srvCaller).Call(0xc0062ad8c0, 0x3cea280, 0xc0062ad900, 0x0, 0x0, 0x3129e40, 0xc00b1610a0, 0x199, 0xc00aa5fca0, 0x2654d0ac, ...)
        /opt/go/src/github.com/juju/juju/apiserver/root.go:158 +0xd6
github.com/juju/juju/rpc.(*Conn).runRequest(0xc000afde00, 0x3cd5f80, 0xc0062ad8c0, 0x38608d8, 0x5, 0xc0051d1648, 0x6, 0x2, 0x0, 0x0, ...)
        /opt/go/src/github.com/juju/juju/rpc/server.go:560 +0x1ab
created by github.com/juju/juju/rpc.(*Conn).handleRequest
        /opt/go/src/github.com/juju/juju/rpc/server.go:467 +0x8f9

So, for example:

// In 2.4.7 controller
juju deploy ~jameinel/ubuntu-lite app1

juju upgrade-juju -m controller --agent-version 2.5-beta3

juju deploy ~/jameinel/ubuntu-lite app2 // this panics

Tags: api
Changed in juju:
status: New → Triaged
importance: Undecided → Critical
assignee: nobody → Heather Lanigan (hmlanigan)
Changed in juju:
assignee: Heather Lanigan (hmlanigan) → Simon Richardson (simonrichardson)
Changed in juju:
status: Triaged → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
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.