Github user ustcweizhou commented on the pull request: https://github.com/apache/cloudstack/pull/1430#issuecomment-198239218 stop the management server, and restart cloudstack-agent during the stopping. 1. without the commit 3683dff : ``` 2016-03-17 21:25:26,359 ERROR [utils.nio.NioConnection] (main:null) Unable to initialize the threads. java.io.IOException: Connection closed with -1 on reading size. at com.cloud.utils.nio.Link.doHandshake(Link.java:513) at com.cloud.utils.nio.NioClient.init(NioClient.java:80) at com.cloud.utils.nio.NioConnection.start(NioConnection.java:88) at com.cloud.agent.Agent.start(Agent.java:228) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:401) at com.cloud.agent.AgentShell.launchAgentFromClassInfo(AgentShell.java:369) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:353) at com.cloud.agent.AgentShell.start(AgentShell.java:463) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:243) 2016-03-17 21:25:26,362 INFO [utils.exception.CSExceptionErrorCode] (main:null) Could not find exception: com.cloud.utils.exception.NioConnectionException in error code list for exceptions 2016-03-17 21:25:26,362 ERROR [cloud.agent.AgentShell] (main:null) Unable to start agent: com.cloud.utils.exception.CloudRuntimeException: Unable to start the connection! at com.cloud.agent.Agent.start(Agent.java:230) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:401) at com.cloud.agent.AgentShell.launchAgentFromClassInfo(AgentShell.java:369) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:353) at com.cloud.agent.AgentShell.start(AgentShell.java:463) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:243) Caused by: com.cloud.utils.exception.NioConnectionException: Connection closed with -1 on reading size. at com.cloud.utils.nio.NioConnection.start(NioConnection.java:94) at com.cloud.agent.Agent.start(Agent.java:228) ... 9 more Caused by: java.io.IOException: Connection closed with -1 on reading size. at com.cloud.utils.nio.Link.doHandshake(Link.java:513) at com.cloud.utils.nio.NioClient.init(NioClient.java:80) at com.cloud.utils.nio.NioConnection.start(NioConnection.java:88) ... 10 more 2016-03-17 21:25:26,363 INFO [cloud.agent.Agent] (AgentShutdownThread:null) Stopping the agent: Reason = sig.kill 2016-03-17 21:25:26,364 DEBUG [cloud.agent.Agent] (AgentShutdownThread:null) Sending shutdown to management server ``` 2. with the commit 3683dff , agent.log show the following log every 5 seconds, until agent connects to management server: ``` 2016-03-18 08:10:45,518 INFO [utils.nio.NioClient] (main:null) Connecting to 172.16.15.10:8250 2016-03-18 08:10:45,529 ERROR [utils.nio.NioConnection] (main:null) Unable to initialize the threads. java.io.IOException: Connection closed with -1 on reading size. at com.cloud.utils.nio.Link.doHandshake(Link.java:513) at com.cloud.utils.nio.NioClient.init(NioClient.java:80) at com.cloud.utils.nio.NioConnection.start(NioConnection.java:88) at com.cloud.agent.Agent.start(Agent.java:236) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:401) at com.cloud.agent.AgentShell.launchAgentFromClassInfo(AgentShell.java:369) at com.cloud.agent.AgentShell.launchAgent(AgentShell.java:353) at com.cloud.agent.AgentShell.start(AgentShell.java:463) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:243) 2016-03-18 08:10:45,530 INFO [utils.exception.CSExceptionErrorCode] (main:null) Could not find exception: com.cloud.utils.exception.NioConnectionException in error code list for exceptions 2016-03-18 08:10:45,530 INFO [cloud.agent.Agent] (main:null) Attempted to connect to the server, but received an unexpected exception, trying again... ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---