Runtime error: invalid memory address or nil pointer dereference

Bug #2064174 reported by Ethan Myers
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Committed
Critical
Heather Lanigan
3.4
Fix Released
Critical
Heather Lanigan
3.5
Fix Committed
Critical
Heather Lanigan

Bug Description

Juju version: 3.4.2
Juju manual cloud

Have seen a couple of similar errors, but looks like this one is new. I get a "invalid memory address or nil pointer dereference" in juju when trying to deploy a charmed app (Landscape) to a pre-created container on a manual cloud.

This is a manual cloud, with 3 pre-created VMs inside. Each VM has 3 containers attached to it. All are in status "started" with an IP assigned.

Traceback from the juju deploy command (with --verbose): https://paste.ubuntu.com/p/gnHRgZW2wH/

command looks like:

```
juju deploy landscape-server --channel stable --revision 107 --to 0/lxd/0 --debug
```
```

Happy to provide more logs, but even with verbose there's not a ton of details.

Issue is reproducible on this setup (eg. every deploy attempt results in the error) but haven't destroyed the env to see if it continues to occur.

Revision history for this message
Joseph Phillips (manadart) wrote (last edit ):

Can you check the log in /var/log/juju/machine-x.log? This should have the stack trace. What you see in the pastebin is just the client side reporting of the error.

Revision history for this message
Ethan Myers (ethanmyers) wrote :

Looking at the logs, I don't see any *new* machine logs on the container being generated. Even retriggering the juju deploy command again, the date stamps aren't updated. However, the log as requested: https://paste.ubuntu.com/p/GMvzgsMP6m/

This is probably because juju can't directly ssh into the containers (but it can talk to the host for the containers, eg to create them). This is inside Azure, so the networking is somewhat unusual.

If there's a better config here for juju talking to the containers, I would appreciate any advice.

Revision history for this message
Joseph Phillips (manadart) wrote :

The container logs themselves are unlikely to have this. It will be in the logs on the controller if anywhere.

Changed in juju:
status: New → Incomplete
Revision history for this message
Paul Goins (vultaire) wrote :

I hit this same issue when creating a test container for a customer environment. If I did "juju add-machine" and then tried to deploy "--to #/lxd/#", I get this error. If I deploy "--to lxd:#" instead and let "juju deploy" set up the machine, it works. Also Juju 3.4.2.

Revision history for this message
Paul Goins (vultaire) wrote :
Download full text (6.4 KiB)

I just reproduced it now.

From the client side, I see this:

$ date; juju --debug deploy ubuntu this-will-fail --to 11/lxd/2; date
Fri May 3 06:12:53 PM UTC 2024
18:12:53 INFO juju.cmd supercommand.go:56 running juju [3.4.2 a80becbb4da5985fa53c63824a4bd809e9d03954 gc go1.21.8]
18:12:53 DEBUG juju.cmd supercommand.go:57 args: []string{"/snap/juju/26968/bin/juju", "--debug", "deploy", "ubuntu", "this-will-fail", "--to", "11/lxd/2"}
18:12:53 INFO juju.juju api.go:86 connecting to API addresses: [10.42.1.99:17070 10.42.1.91:17070 10.42.1.103:17070]
18:12:53 DEBUG juju.api apiclient.go:1172 successfully dialed "wss://10.42.1.91:17070/model/5ffc4276-3ba6-4eae-8322-a8ba33c3123a/api"
18:12:53 INFO juju.api apiclient.go:707 connection established to "wss://10.42.1.91:17070/model/5ffc4276-3ba6-4eae-8322-a8ba33c3123a/api"
18:12:53 INFO juju.juju api.go:86 connecting to API addresses: [10.42.1.91:17070 10.42.1.103:17070 10.42.1.99:17070]
18:12:53 DEBUG juju.api apiclient.go:1172 successfully dialed "wss://10.42.1.99:17070/api"
18:12:53 INFO juju.api apiclient.go:707 connection established to "wss://10.42.1.99:17070/api"
18:12:54 ERROR cmd charm.go:388 runtime error: invalid memory address or nil pointer dereference
18:12:54 DEBUG juju.api monitor.go:35 RPC connection died
18:12:54 DEBUG juju.api monitor.go:35 RPC connection died
ERROR failed to deploy charm "ubuntu"
18:12:54 DEBUG cmd supercommand.go:549 error stack:
github.com/juju/juju/cmd/juju/application/deployer.(*repositoryCharm).PrepareAndDeploy:391: failed to deploy charm "ubuntu"
Fri May 3 06:12:54 PM UTC 2024

The matching logs on the controller, in machine-0.log, are:

2024-05-03 18:12:32 CRITICAL juju.rpc server.go:557 panic running request {MethodCaller:0xc00b940570 transformErrors:0x3c616c0 hdr:{RequestId:4 Request:{Type:Application Version:19 Id: Action:DeployFromRepository} Error: ErrorCode: ErrorInfo:map[] Version:1}} with arg {Args:[{CharmName:ubuntu ApplicationName:this-will-fail AttachStorage:[] Base:<nil> Channel:<nil> ConfigYAML:this-will-fail: {}
 Cons: Devices:map[] DryRun:false EndpointBindings:map[] Force:false NumUnits:0xc0040c8a70 Placement:[#:11/lxd/2] Revision:<nil> Resources:map[] Storage:map[] Trust:false}]}: runtime error: invalid memory address or nil pointer dereference
goroutine 21344914 [running]:
runtime/debug.Stack()
        /snap/go/current/src/runtime/debug/stack.go:24 +0x65
github.com/juju/juju/rpc.(*Conn).runRequest.func1()
        /build/snapcraft-juju-38292071f4d4886eaedb64ffe94254b4/parts/jujud/build/rpc/server.go:558 +0x7d
panic({0x6b1d140, 0xc0f1440})
        /snap/go/current/src/runtime/panic.go:884 +0x213
github.com/juju/juju/apiserver/facades/client/application.(*deployFromRepositoryValidator).platformFromPlacement(0xc0015373e0, {0xc00e266ec0, 0x1, 0x0?})
        /build/snapcraft-juju-38292071f4d4886eaedb64ffe94254b4/parts/jujud/build/apiserver/facades/client/application/deployrepository.go:690 +0x4f5
github.com/juju/juju/apiserver/facades/client/application.(*deployFromRepositoryValidator).deducePlatform(_, {{0xc0040c8a48, 0x6}, {0xc0040c8a60, 0xe}, {0x0, 0x0, 0x0}, 0x0, 0x0, ...})
        /build/snapcraft-juju-38292071f4d4886eaedb64ffe942...

Read more...

Changed in juju:
status: Incomplete → Triaged
importance: Undecided → Critical
assignee: nobody → Heather Lanigan (hmlanigan)
milestone: none → 3.3.5
Changed in juju:
status: Triaged → In Progress
Revision history for this message
Heather Lanigan (hmlanigan) wrote (last edit ):

We're not setting the architecture of 0/lxd/0 in the instanceData.

Revision history for this message
Heather Lanigan (hmlanigan) wrote :
Changed in juju:
milestone: 3.3.5 → 3.3.6
Harry Pidcock (hpidcock)
Changed in juju:
status: In Progress → Fix Committed
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.