anshul1886 commented on a change in pull request #1845: CLOUDSTACK-9689: [Hyper-V] Fixed VM console is freezing sometimes and? URL: https://github.com/apache/cloudstack/pull/1845#discussion_r117695756
########## File path: services/console-proxy-rdp/rdpconsole/src/main/java/streamer/apr/AprSocketSource.java ########## @@ -103,44 +103,46 @@ public void poll(boolean block) { if (verbose) System.out.println("[" + this + "] INFO: Reading data from stream."); - // to unblock during reboot - long startTime = System.currentTimeMillis(); // FIXME: If pull is destroyed or socket is closed, segfault will happen here - int actualLength = (block) ? // Blocking read - Socket.recv(socket, buf.data, buf.offset, buf.data.length - buf.offset) - : // Non-blocking read - Socket.recvt(socket, buf.data, buf.offset, buf.data.length - buf.offset, 5000000); + int actualLength; + if(block) { + // Blocking read + actualLength = Socket.recv(socket, buf.data, buf.offset, buf.data.length - buf.offset); + } else { + // non blocking read with 5 seconds timeout + Socket.timeoutSet(socket, 5000000); + actualLength = Socket.recv(socket, buf.data, buf.offset, buf.data.length - buf.offset); Review comment: @ramkatru If APR_SO_NONBLOCK flag is disabled then set timeout will not work. This is done this way so that connection gets reset during reboot of VM. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services