Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Bug 1065047 - changed exception raised to NodeUnavailableException to in... #5278

Merged
merged 1 commit into from
Apr 16, 2014

Conversation

lnader
Copy link
Contributor

@lnader lnader commented Apr 16, 2014

...dicate retry advisable (503)

  • Changed exception raised by rpcclient to NodeUnavailableException to indicate that retry is advisable. i.e. results in HTTP status code 503
  • nil checking on rpc_client before calling disconnect to prevent runtime exception being thrown when connection is unsuccessful. i.e. undefined method `disconnect' for nil:NilClass

Not really dependent but related pull request

https://github.com/openshift/li/pull/2609

@lnader
Copy link
Contributor Author

lnader commented Apr 16, 2014

@danmcp - please review

@@ -2365,7 +2365,7 @@ def self.rpc_exec(agent, server, force_rediscovery=false, options=rpc_options)
begin
result = yield rpc_client
ensure
rpc_client.disconnect
rpc_client.disconnect unless rpc_client.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not seeing how rpc_client can be nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When activeMQ is down and it cannot connect then it is nil, which then causes "undefined method `disconnect' for nil:NilClass" exception to be thrown, which then masks the original exception NodeUnavailableException, which is thrown when connection fails.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would mean this line:

rpc_client = rpcclient(agent, flags)

can return nil. Is that the case? Would be a strange pattern. If it does we should catch the issue there and raise the exception immediately. And secondly if it does, this wouldn't be the right fix since rpc_client is referenced several times before it gets to this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line
rpc_client = rpcclient(agent, flags)
will throw an exception but since ensure gets called regardless of an exception having been thrown earlier in the code it still tries to disconnect.

@lnader
Copy link
Contributor Author

lnader commented Apr 16, 2014

[test]

@openshift-bot
Copy link

@openshift-bot
Copy link

Origin Test Results: Running (https://originci-openshift.rhcloud.com/job/test_pull_requests/2054/)

@openshift-bot
Copy link

Online Merge Results: SUCCESS (https://ci.dev.openshift.redhat.com/jenkins/job/merge_pull_requests/5278/) (Image: devenv_4687)

@openshift-bot
Copy link

Evaluated for online up to c66d9cf

@openshift-bot
Copy link

Evaluated for origin up to c66d9cf

@danmcp
Copy link
Contributor

danmcp commented Apr 16, 2014

[merge]

openshift-bot pushed a commit that referenced this pull request Apr 16, 2014
Merged by openshift-bot
@openshift-bot openshift-bot merged commit 9ab4130 into openshift:master Apr 16, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants