relation-get with invalid relation name panics agent

Bug #1365412 reported by Stuart Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
Dave Cheney
1.20
Fix Released
Critical
Ian Booth

Bug Description

In debug-hooks, I typed 'relation-get - db' instead of 'relation-get - db/0', and crashed the agent.

panic: "db" is not a valid unit name

goroutine 2613 [running]:
runtime.panic(0xc1d0e0, 0xc2101fda30)
 /usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/juju/names.NewUnitTag(0xc2102adcc8, 0x2, 0xc2101fda10, 0xc)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/names/unit.go:30 +0x28f
github.com/juju/juju/state/api/uniter.(*RelationUnit).ReadSettings(0xc210114300, 0xc2102adcc8, 0x2, 0x2, 0x118f6c0, ...)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/juju/state/api/uniter/relationunit.go:138 +0x42
github.com/juju/juju/worker/uniter.(*ContextRelation).ReadSettings(0xc210113d80, 0xc2102adcc8, 0x2, 0xc210113d80, 0x0, ...)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/juju/worker/uniter/context.go:433 +0xdc
github.com/juju/juju/worker/uniter/jujuc.(*RelationGetCommand).Run(0xc2101a5870, 0xc2101a58c0, 0xc2101a58c0, 0x0)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/juju/worker/uniter/jujuc/relation-get.go:90 +0x2d2
github.com/juju/cmd.Main(0x7fa7bd5c2008, 0xc2101a5870, 0xc2101a58c0, 0xc210216f80, 0x2, ...)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/cmd/cmd.go:247 +0x283
github.com/juju/juju/worker/uniter/jujuc.(*Jujuc).Main(0xc21038b700, 0xc210207180, 0x34, 0xc210201c60, 0x2c, ...)
 /build/buildd/juju-core-1.20.6/src/github.com/juju/juju/worker/uniter/jujuc/server.go:104 +0x5fd
reflect.Value.call(0xd4f6a0, 0xd84430, 0x130, 0xf31990, 0x4, ...)
 /usr/lib/go/src/pkg/reflect/value.go:474 +0xe0b
reflect.Value.Call(0xd4f6a0, 0xd84430, 0x130, 0x7fa7b83d6ee8, 0x3, ...)
 /usr/lib/go/src/pkg/reflect/value.go:345 +0x9d
net/rpc.(*service).call(0xc2102afcc0, 0xc2102afc80, 0xc2102ad8a8, 0xc2101ac000, 0xc21021f880, ...)
 /usr/lib/go/src/pkg/net/rpc/server.go:381 +0x159
created by net/rpc.(*Server).ServeCodec
 /usr/lib/go/src/pkg/net/rpc/server.go:452 +0x3bb

Revision history for this message
Stuart Bishop (stub) wrote :

Full panic at http://pastebin.ubuntu.com/8231715/ in case it is needed. Flagged CRITICAL per jam's opinion.

Changed in juju-core:
importance: Undecided → Critical
Revision history for this message
John A Meinel (jameinel) wrote :

I'm targetting 1.20 since Stub said that is what he was using.
Essentially, bad input to the system (typo in a relation-get request) should not be able to crash the API server.

Changed in juju-core:
milestone: none → 1.21-alpha1
status: New → Triaged
Revision history for this message
John A Meinel (jameinel) wrote :

The comment from Dave Cheney was that the code should be using ParseUnitTag rather than NewUnitTag, I haven't dug into the code at all.

Revision history for this message
Ian Booth (wallyworld) wrote :

1.20.7 is in the process of being released so moving to 1.20.8 milestone

Revision history for this message
Dave Cheney (dave-cheney) wrote :
Changed in juju-core:
assignee: nobody → Dave Cheney (dave-cheney)
status: Triaged → In Progress
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
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.