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

Check if response is not nil #215

Merged
merged 1 commit into from
Oct 13, 2020
Merged

Conversation

bennyz
Copy link
Member

@bennyz bennyz commented Oct 5, 2020

Description of the Change

Before executing the relevant FollowLink method, make sure the response we got from the engine is not nil, otherwise the response object will be nil and panic.

Alternate Designs

Benefits

This is a bug fix. If ovirt-engine is not accessible before a FollowLink call, it will panic because the response object will be nil.

Possible Drawbacks

Verification Process

This can be reproduced easily by terminating the ovirt-engine process right before the FollowLink call, an example stack trace would look like this:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xca3385]

goroutine 1 [running]:
github.com/ovirt/go-ovirt.(*DiskServiceGetResponse).Disk(0x0, 0x0, 0x0)
        /home/bzlotnik/Development/go/src/github.com/ovirt/go-ovirt/services.go:119416 +0x5
reflect.Value.call(0x102ce60, 0xc0001cb468, 0x293, 0x114312e, 0x4, 0xc0001c5c58, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/lib/golang/src/reflect/value.go:460 +0x8ab
reflect.Value.Call(0x102ce60, 0xc0001cb468, 0x293, 0xc0001c5c58, 0x0, 0x0, 0x1, 0xc, 0x0)
        /usr/lib/golang/src/reflect/value.go:321 +0xb4
github.com/ovirt/go-ovirt.(*Connection).FollowLink(0xc00015a000, 0x128ba60, 0xc0001351e0, 0x1, 0x1, 0x14, 0x0)
        /home/bzlotnik/Development/go/src/github.com/ovirt/go-ovirt/connection.go:172 +0x7d2
main.main()
        ...

I used this snippet[1] to reproduce, with my patch the result is:

sleep before follow
follow failed: Failed to get response

https://gist.github.com/bennyz/d5b5f5112aa4b1ea27b6dc41791a8fab

Applicable Issues

Before executing the relevant FollowLink method, make sure the response
we got from the engine is not nil, otherwise the response object will be
nil and panic.

Signed-off-by: Benny Zlotnik <[email protected]>
bennyz added a commit to bennyz/csi-driver-operator that referenced this pull request Oct 5, 2020
connection#FollowLink issues an additional HTTP call which may fail if ovirt-engine
suddenly becomes unavailable.

Currently it will panic, but once [1] is merged, an error will be
returned.

[1] oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Benny Zlotnik <[email protected]>
bennyz added a commit to bennyz/csi-driver-operator that referenced this pull request Oct 5, 2020
connection#FollowLink issues an additional HTTP call which may fail if ovirt-engine
suddenly becomes unavailable.

Currently it will panic, but once [1] is merged, an error will be
returned.

[1] oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Benny Zlotnik <[email protected]>
bennyz added a commit to bennyz/csi-driver-operator that referenced this pull request Oct 5, 2020
connection#FollowLink issues an additional HTTP call which may fail if ovirt-engine
suddenly becomes unavailable.

Currently it will panic, but once [1] is merged, an error will be
returned.

[1] oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Benny Zlotnik <[email protected]>
@imjoey
Copy link
Member

imjoey commented Oct 13, 2020

@bennyz LGTM. Nice catch. Thank you very much for this. Let's merge this.

@imjoey imjoey merged commit 443b353 into oVirt:master Oct 13, 2020
Gal-Zaidman pushed a commit to Gal-Zaidman/ovirt-csi-driver that referenced this pull request Nov 15, 2020
bumped go-ovirt version to the latest to consume:
1. oVirt/ovirt-engine-sdk-go#217
2. oVirt/ovirt-engine-sdk-go#215

Also ran make vendor which added protobuf

Signed-off-by: Gal-Zaidman <[email protected]>
Gal-Zaidman pushed a commit to Gal-Zaidman/ovirt-csi-driver that referenced this pull request Nov 15, 2020
bumped go-ovirt version to the latest to consume:
1. oVirt/ovirt-engine-sdk-go#217
2. oVirt/ovirt-engine-sdk-go#215

Also ran make vendor which added protobuf

Signed-off-by: Gal-Zaidman <[email protected]>
Gal-Zaidman pushed a commit to Gal-Zaidman/ovirt-csi-driver-operator that referenced this pull request Nov 15, 2020
bumped go-ovirt version to the latest to consume:

oVirt/ovirt-engine-sdk-go#217
oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Gal-Zaidman <[email protected]>
Gal-Zaidman pushed a commit to Gal-Zaidman/ovirt-csi-driver-operator that referenced this pull request Nov 15, 2020
bumped go-ovirt version to the latest to consume:

oVirt/ovirt-engine-sdk-go#217
oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Gal-Zaidman <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ovirt-csi-driver-operator that referenced this pull request Jan 12, 2021
connection#FollowLink issues an additional HTTP call which may fail if ovirt-engine
suddenly becomes unavailable.

Currently it will panic, but once [1] is merged, an error will be
returned.

[1] oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Benny Zlotnik <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ovirt-csi-driver-operator that referenced this pull request Jan 12, 2021
bumped go-ovirt version to the latest to consume:

oVirt/ovirt-engine-sdk-go#217
oVirt/ovirt-engine-sdk-go#215

Signed-off-by: Gal-Zaidman <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants