Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: invalid memory address or nil pointer dereference #141

Closed
jonc650 opened this issue Oct 17, 2014 · 8 comments
Closed

Comments

@jonc650
Copy link

jonc650 commented Oct 17, 2014

I currently get the following error on both OSX and Linux for all commands:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x1 pc=0x80e7fbc]

goroutine 1 [running]:
runtime.panic(0x8691a20, 0x9584c28)
/usr/lib/golang/src/pkg/runtime/panic.c:266 +0xac
sync/atomic.AddUint64(0x1982eb44, 0x1, 0x0, 0x1980a5e0, 0x0)
/usr/lib/golang/src/pkg/sync/atomic/asm_386.s:118 +0xc
github.com/vmware/govmomi/vim25/soap.(_Client).RoundTrip(0x1982eaf0, 0xb78941a0, 0x1980a5d0, 0xb78941a0, 0x1980a5e0, ...)
/workspace/src/github.com/vmware/govmomi/vim25/soap/client.go:127 +0x11b
github.com/vmware/govmomi/vim25/methods.RetrieveServiceContent(0xb7894188, 0x1982eaf0, 0x1980a5c0, 0x9588790, 0x1, ...)
/workspace/src/github.com/vmware/govmomi/vim25/methods/methods.go:9657 +0x99
github.com/vmware/govmomi.serviceContent(0xb7894188, 0x1982eaf0, 0x9587e70, 0xb7894188, 0x1981cee0, ...)
/workspace/src/github.com/vmware/govmomi/client.go:43 +0x8b
github.com/vmware/govmomi.NewClient(0xbfd5a89f, 0x5, 0x0, 0x0, 0x1981cee0, ...)
/workspace/src/github.com/vmware/govmomi/client.go:79 +0xbe
github.com/vmware/govmomi/govc/flags.(_ClientFlag).newClient(0x1981ce80, 0x0, 0x0, 0x0)
/workspace/src/github.com/vmware/govmomi/govc/flags/client.go:141 +0x61
github.com/vmware/govmomi/govc/flags.(_ClientFlag).Client(0x1981ce80, 0x19800680, 0x196, 0x198a34a4)
/workspace/src/github.com/vmware/govmomi/govc/flags/client.go:207 +0xcf
github.com/vmware/govmomi/govc/about.(_about).Run(0x19800680, 0x198a3680, 0x0, 0x0)
/workspace/src/github.com/vmware/govmomi/govc/about/command.go:42 +0x3a
github.com/vmware/govmomi/govc/cli.Run(0x1980a008, 0x1, 0x1, 0x19800680)
/workspace/src/github.com/vmware/govmomi/govc/cli/command.go:151 +0x4f2
main.main()
/workspace/src/github.com/vmware/govmomi/govc/main.go:42 +0x54

An strace show's it having issues with the session file not existing.

clock_gettime(CLOCK_REALTIME, {1413556864, 473082132}) = 0
open("/root/.govmomi/sessions/myuser@myesxhost.com?insecure=true", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
clock_gettime(CLOCK_REALTIME, {1413556864, 474050323}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
rt_sigreturn(0x198010a0) = 140738048
write(2, "panic: ", 7panic: ) = 7
write(2, "runtime error: invalid memory ad"..., 64runtime error: invalid memory address or nil pointer dereference) = 64

/root/.govmomi/sessions/ didn't exist, so I created it, but still get the same error.

@jonc650
Copy link
Author

jonc650 commented Oct 17, 2014

I've been a bit hasty with the above - this is probably due to us using vsphere 5. I'll close this, and you can add vSphere 5.0.0 to your incompatible list!

@jonc650 jonc650 closed this as completed Oct 17, 2014
dougm added a commit to dougm/govmomi that referenced this issue Oct 17, 2014
If credentials are not provided in the govc url, govc would panic.

Fixes github issue vmware#141
@dougm
Copy link
Member

dougm commented Oct 17, 2014

@jonc650 I was able to reproduce this issue, fix is in #142 - can you give it a try? Thanks.

@jonc650
Copy link
Author

jonc650 commented Oct 18, 2014

I've just updated to the latest, but I still see the same issue.

dougm added a commit to dougm/govmomi that referenced this issue Oct 18, 2014
@dougm
Copy link
Member

dougm commented Oct 18, 2014

I should have looked closer at your stack trace.. looks like you are using 32-bit go and we were bitten by this issue: https://code.google.com/p/go/issues/detail?id=6404

I did reproduce with 32-bit go. Can you try updating again to include #143 ?

@jonc650
Copy link
Author

jonc650 commented Oct 20, 2014

That seems to have fixed this issue - Thanks. I'm not yet getting a valid response back from 'about', but that's more likely to be something I'm not doing right or a problem due to versions than an issue!

govc about
Error: expected element type but have

Thanks

Jon

@pietern
Copy link
Contributor

pietern commented Oct 20, 2014

Hi @jonc650, I think a version incompatibility is the most likely here. Any chance you can upgrade to 5.5?

@dougm
Copy link
Member

dougm commented Oct 20, 2014

Works for me against ESX 5.0 - @jonc650 does your url point directly to an ESX box or vCenter? You can try: govc about -debug ... and have a look at ~/.govmomi/debug//.res.xml to see the response. In your case, the error happens when trying to unmarshal the response:

vim25/xml/read.go: e := "expected element <" + finfo.name + "> in name space " + finfo.xmlns + " but have "

% govc about
Name: VMware ESXi
Vendor: VMware, Inc.
Version: 5.0.0
Build: 1243428
OS type: vmnix-x86
API type: HostAgent
API version: 5.0
Product ID: embeddedEsx
UUID:

@jonc650
Copy link
Author

jonc650 commented Oct 21, 2014

Hello

This is using vCenter. Strangely I randomly started getting a cert error instead of the above yesterday, and when I added -k=true I got a result, so it must have been something to do with our infrastructure at the time. I don't look after the VMware infrastructure, I just need to extract info from it as a sysadmin. There is the possibility we will be upgrading next year, but until then it now seems to work. Thanks for your help with this.

Jon

tkak pushed a commit to tkak/govmomi that referenced this issue Dec 27, 2014
If credentials are not provided in the govc url, govc would panic.

Fixes github issue vmware#141
tkak pushed a commit to tkak/govmomi that referenced this issue Dec 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants