Uh oh!
There was an error while loading. Please reload this page.
CLOUDSTACK-9285 for 4.7.x - #1430
Conversation
| _connection.start(); | ||
| } catch (final NioConnectionException e) { | ||
| throw new CloudRuntimeException("Unable to start the connection!", e); | ||
| s_logger.info("Attempted to connect to the server, but received an unexpected exception, trying again..."); |
There was a problem hiding this comment.
- I think you should fix line 230/238, that's the root cause of the issue. line 415 is not.
- line 416 can be removed.
kiwiflyer
commented
Mar 7, 2016
@ustcweizhou Thanks for the advice. Maybe I can catch you on the slack channel tomorrow to discuss a little, so I better understand the logic between start and reconnect. |
ustcweizhou
commented
Mar 8, 2016
@kiwiflyer this is the log in jira: @wilderrodrigues this issue was introduced by your commit 79a3f8c, can you please have a look? |
kiwiflyer
commented
Mar 8, 2016
@ustcweizhou |
ustcweizhou
commented
Mar 8, 2016
@kiwiflyer Simon, I agree with you. Besides your change, we also need to fix similar issue in line 230/238. |
kiwiflyer
commented
Mar 8, 2016
@ustcweizhou I've cleaned up the other 2 exceptions and also removed the newline you pointed out eariler. |
ustcweizhou
commented
Mar 8, 2016
@kiwiflyer code LGTM. |
kiwiflyer
commented
Mar 8, 2016
@ustcweizhou Does 3683dff work? |
ustcweizhou
commented
Mar 16, 2016
@kiwiflyer3683dff LGTM |
ustcweizhou
commented
Mar 18, 2016
stop the management server, and restart cloudstack-agent during the stopping.
|
kiwiflyer
commented
Mar 22, 2016
Test log for reconnect scenerio: Agent throws an exception that can never be recovered from when the agent attempts to reconnect and is sent a RST. This case occurs when a load balancer (haproxy) is proxying the traffic and there is no management server active to serve the request on the backend. Original issue logs from agent.log: 2016-03-03 17:15:36,527 INFO utils.nio.NioClient (logid:) NioClient connection closed 2016-03-03 17:50:05,190 INFO utils.nio.NioClient (logid:) NioClient connection closed This has been tested on 4.7.1 and master. |
DaanHoogland
commented
Mar 22, 2016
LGTM based on field experience and code inspection |
DaanHoogland
commented
Mar 22, 2016
@swill dear RM, can we merge this in 4.7 and merge forward |
CLOUDSTACK-9285 for 4.7.xPer Daan's request, here is a pull request for the 4.7.x release. * pr/1430: Cloudstack 9285 for 4.7.x CLOUDSTACK-9285 - Address original on start exception(s) and newline cleanup Cloudstack 9285 for 4.7.x Signed-off-by: Will Stevens <williamstevens@gmail.com>
rafaelweingartner
commented
Mar 24, 2016
this was merged without functional tests (integration tests)? |
swill
commented
Mar 24, 2016
output was posted for test run against master and 4.7. maybe I jumped the gun? |
swill
commented
Mar 24, 2016
i will make sure that integration test are run against everything going forward. this judgment call may have been premature. |
rafaelweingartner
commented
Mar 24, 2016
The test output you mean was the one posted by @kiwiflyer ? At class “Agent.java” lines, 230, 238 and 451, (despite being the very same piece of code) I worry about the exception that is not being logged. I mean, we will see that message, but the exception stack that might be useful for debugging will not be logged. Additionally, the code between lines 232 and 239, it seems that it might occur an infinite loop there (before the commit the throw new CloudRuntimeException would break it). I know that when we deal with a connection to a resource, there are hundreds of things that can go wrong and sometimes if we try once or twice it might solve the problem. However, a code that may enter into an infinite loop with a hidden exception does not sound a neat solution for me. Would not it be better to retry a few times and then, if nothing changes, let an exception happens to break that flow of execution? |
swill
commented
Mar 24, 2016
I see your point and I agree with you. What do you think is a reasonable amount of time to check before we throw the error? |
kiwiflyer
commented
Mar 24, 2016
I want to point out that this is taking care of the case where you have a load balancer between the agents and the management server (see original issue notes). I'm personally not convinced that letting an exception be thrown that causes the agent to fail, that is most likely caused by an underlying network connectivity issue is a great solution either. Tomcat doesn't get taken down, so the agent container is functional, but the application is dead. If a set number of retries is added, there has to be a clean termination of the agent so some other health checking application can restart the agent, without requiring manual intervention (very painful if you have lots of hosts). |
swill
commented
Mar 24, 2016
so you are basically saying that if the connection can not be established, it is not functional anyway, so there is no point in this timing out? |
rafaelweingartner
commented
Mar 24, 2016
That is it; @ kiwiflyer, I do not know that class. Is that the agent we use in system VMs? Or the ones we install in some hypervisors? |
kiwiflyer
commented
Mar 24, 2016
@rafaelweingartner This is used in both the system VM agent and the host (hypervisor) agent. |
kiwiflyer
commented
Mar 24, 2016
@swill This exception is thrown when the NIO operations used to establish the connection to the management server on port 8250 fail.When this exception gets thrown, the agent is dead and has to be manually restarted. The tomcat container, however, is still up. |
rafaelweingartner
commented
Mar 24, 2016
Ok, If an exception is thrown and it is not handled properly the agent dies. If the agent dies, ACS does not deal with it, right? In that case, I would be inclined to accept the infinite loop when starting a connection. I would only suggest not hiding the exception there, and logging it together with messages at lines 239, 238 and 415. I just wonder why we need to maintain a connection like this one always open. For me, it seems that if we only opened it when sending a command/message, then we could send the command/message, and after that we could close the connection. Therefore, if it is not possible to open a connection we could just lose a command/message (just thoughts, nothing that we would do right now). |
kiwiflyer
commented
Mar 24, 2016
@rafaelweingartner Yes, you are correct. I like your suggestion. I'll log the exception with the failure. In terms of the persistent connections, I believe the management server pushes to the agents. It also relies on the agent connection to determine health information for the agent and the VMs located on each host. |
rafaelweingartner
commented
Mar 24, 2016
@kiwiflyer, it is nice that we achieved a consensus. How do we proceed now? This PR has already been merged and forwarded. |
swill
commented
Mar 24, 2016
@rafaelweingartner I agree. I think it makes the most sense to open a new PR to add the exception log. @kiwiflyer would you mind doing that for us? Would you mind giving the output as you did before to show what is displayed in the logs when this code is hit? Thanks for the quick and quality discussion on this guys. |
rafaelweingartner
commented
Mar 24, 2016
You are welcome. |
swill
commented
Mar 24, 2016
Thank you sir. I really appreciate it. Once I get my CI online I will be able to start getting through this backlog in a much more efficient manner. |
kiwiflyer
commented
Mar 24, 2016
@swill Yes, I'll work on this either today or tomorrow and get a new PR submitted. Thanks guys. |
Per Daan's request, here is a pull request for the 4.7.x release.