org.jboss.netty.handler.timeout.ReadTimeoutException Java Examples
The following examples show how to use
org.jboss.netty.handler.timeout.ReadTimeoutException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NettyHttpServerTransport.java From Elasticsearch with Apache License 2.0 | 6 votes |
protected void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof ReadTimeoutException) { if (logger.isTraceEnabled()) { logger.trace("Connection timeout [{}]", ctx.getChannel().getRemoteAddress()); } ctx.getChannel().close(); } else { if (!lifecycle.started()) { // ignore return; } if (!NetworkExceptionHelper.isCloseConnectionException(e.getCause())) { logger.warn("Caught exception while handling client http traffic, closing connection {}", e.getCause(), ctx.getChannel()); ctx.getChannel().close(); } else { logger.debug("Caught exception while handling client http traffic, closing connection {}", e.getCause(), ctx.getChannel()); ctx.getChannel().close(); } } }
Example #2
Source File: OspfInterfaceChannelHandler.java From onos with Apache License 2.0 | 6 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } }
Example #3
Source File: IsisChannelHandler.java From onos with Apache License 2.0 | 6 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for ISIS {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting ISIS {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof IsisParseException) { IsisParseException errMsg = (IsisParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from ISIS {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from ISIS {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } }
Example #4
Source File: NettyRpcServerHandler.java From voyage with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { RpcRequest request = (RpcRequest) ctx.getAttachment(); if (e.getCause() instanceof ReadTimeoutException) { // The connection was OK but there was no traffic for last period. logger.warn("Disconnecting due to no inbound traffic"); } else { logger.error("", e); } e.getChannel().close().awaitUninterruptibly(); }
Example #5
Source File: FpmSessionHandler.java From onos with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof ReadTimeoutException) { log.warn("Haven't heard from FPM client for a while"); } else { log.error("Exception thrown while handling FPM message", e.getCause()); } if (channel != null) { channel.close(); } handleDisconnect(); }
Example #6
Source File: AbstractRPCChannelHandler.java From floodlight_with_topoguard with Apache License 2.0 | 4 votes |
@Override @LogMessageDocs({ @LogMessageDoc(level="ERROR", message="[{id}->{id}] Disconnecting client due to read timeout", explanation="The connected client has failed to send any " + "messages or respond to echo requests", recommendation=LogMessageDoc.CHECK_CONTROLLER), @LogMessageDoc(level="ERROR", message="[{id}->{id}] Disconnecting RPC node due to " + "handshake timeout", explanation="The remote node did not complete the handshake", recommendation=LogMessageDoc.CHECK_CONTROLLER), @LogMessageDoc(level="ERROR", message="[{id}->{id}] IOException: {message}", explanation="There was an error communicating with the " + "remote client", recommendation=LogMessageDoc.GENERIC_ACTION), @LogMessageDoc(level="ERROR", message="[{id}->{id}] ConnectException: {message} {error}", explanation="There was an error connecting to the " + "remote node", recommendation=LogMessageDoc.GENERIC_ACTION), @LogMessageDoc(level="ERROR", message="[{}->{}] An error occurred on RPC channel", explanation="An error occurred processing the message", recommendation=LogMessageDoc.GENERIC_ACTION), }) public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof ReadTimeoutException) { // read timeout logger.error("[{}->{}] Disconnecting RPC node due to read timeout", getLocalNodeIdString(), getRemoteNodeIdString()); ctx.getChannel().close(); } else if (e.getCause() instanceof HandshakeTimeoutException) { // read timeout logger.error("[{}->{}] Disconnecting RPC node due to " + "handshake timeout", getLocalNodeIdString(), getRemoteNodeIdString()); ctx.getChannel().close(); } else if (e.getCause() instanceof ConnectException || e.getCause() instanceof IOException) { logger.debug("[{}->{}] {}: {}", new Object[] {getLocalNodeIdString(), getRemoteNodeIdString(), e.getCause().getClass().getName(), e.getCause().getMessage()}); } else { logger.error("[{}->{}] An error occurred on RPC channel", new Object[]{getLocalNodeIdString(), getRemoteNodeIdString(), e.getCause()}); ctx.getChannel().close(); } }
Example #7
Source File: OFChannelHandler.java From floodlight_with_topoguard with Apache License 2.0 | 4 votes |
@Override @LogMessageDocs({ @LogMessageDoc(level="ERROR", message="Disconnecting switch {switch} due to read timeout", explanation="The connected switch has failed to send any " + "messages or respond to echo requests", recommendation=LogMessageDoc.CHECK_SWITCH), @LogMessageDoc(level="ERROR", message="Disconnecting switch {switch}: failed to " + "complete handshake", explanation="The switch did not respond correctly " + "to handshake messages", recommendation=LogMessageDoc.CHECK_SWITCH), @LogMessageDoc(level="ERROR", message="Disconnecting switch {switch} due to IO Error: {}", explanation="There was an error communicating with the switch", recommendation=LogMessageDoc.CHECK_SWITCH), @LogMessageDoc(level="ERROR", message="Disconnecting switch {switch} due to switch " + "state error: {error}", explanation="The switch sent an unexpected message", recommendation=LogMessageDoc.CHECK_SWITCH), @LogMessageDoc(level="ERROR", message="Disconnecting switch {switch} due to " + "message parse failure", explanation="Could not parse a message from the switch", recommendation=LogMessageDoc.CHECK_SWITCH), @LogMessageDoc(level="ERROR", message="Terminating controller due to storage exception", explanation=Controller.ERROR_DATABASE, recommendation=LogMessageDoc.CHECK_CONTROLLER), @LogMessageDoc(level="ERROR", message="Could not process message: queue full", explanation="OpenFlow messages are arriving faster than " + " the controller can process them.", recommendation=LogMessageDoc.CHECK_CONTROLLER), @LogMessageDoc(level="ERROR", message="Error while processing message " + "from switch {switch} {cause}", explanation="An error occurred processing the switch message", recommendation=LogMessageDoc.GENERIC_ACTION) }) public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof ReadTimeoutException) { // switch timeout log.error("Disconnecting switch {} due to read timeout", getSwitchInfoString()); counters.switchDisconnectReadTimeout.updateCounterWithFlush(); ctx.getChannel().close(); } else if (e.getCause() instanceof HandshakeTimeoutException) { log.error("Disconnecting switch {}: failed to complete handshake", getSwitchInfoString()); counters.switchDisconnectHandshakeTimeout.updateCounterWithFlush(); ctx.getChannel().close(); } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for sw {} already closed", getSwitchInfoString()); } else if (e.getCause() instanceof IOException) { log.error("Disconnecting switch {} due to IO Error: {}", getSwitchInfoString(), e.getCause().getMessage()); if (log.isDebugEnabled()) { // still print stack trace if debug is enabled log.debug("StackTrace for previous Exception: ", e.getCause()); } counters.switchDisconnectIOError.updateCounterWithFlush(); ctx.getChannel().close(); } else if (e.getCause() instanceof SwitchStateException) { log.error("Disconnecting switch {} due to switch state error: {}", getSwitchInfoString(), e.getCause().getMessage()); if (log.isDebugEnabled()) { // still print stack trace if debug is enabled log.debug("StackTrace for previous Exception: ", e.getCause()); } counters.switchDisconnectSwitchStateException.updateCounterWithFlush(); ctx.getChannel().close(); } else if (e.getCause() instanceof MessageParseException) { log.error("Disconnecting switch " + getSwitchInfoString() + " due to message parse failure", e.getCause()); counters.switchDisconnectParseError.updateCounterWithFlush(); ctx.getChannel().close(); } else if (e.getCause() instanceof StorageException) { log.error("Terminating controller due to storage exception", e.getCause()); this.controller.terminate(); } else if (e.getCause() instanceof RejectedExecutionException) { log.warn("Could not process message: queue full"); counters.rejectedExecutionException.updateCounterWithFlush(); } else { log.error("Error while processing message from switch " + getSwitchInfoString() + "state " + this.state, e.getCause()); counters.switchDisconnectOtherException.updateCounterWithFlush(); ctx.getChannel().close(); } }
Example #8
Source File: PcepChannelHandler.java From onos with Apache License 2.0 | 4 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { PcepErrorMsg errMsg; log.info("exceptionCaught: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { if (ChannelState.OPENWAIT == state) { // When ReadTimeout timer is expired in OPENWAIT state, it is considered // OpenWait timer. errMsg = getErrorMsg(PcepErrorDetailInfo.ERROR_TYPE_1, PcepErrorDetailInfo.ERROR_VALUE_2); log.debug("Sending PCEP-ERROR message to PCC."); controller.peerExceptions(peerAddr, e.getCause().toString()); channel.write(Collections.singletonList(errMsg)); channel.close(); state = ChannelState.INIT; return; } else if (ChannelState.KEEPWAIT == state) { // When ReadTimeout timer is expired in KEEPWAIT state, is is considered // KeepWait timer. errMsg = getErrorMsg(PcepErrorDetailInfo.ERROR_TYPE_1, PcepErrorDetailInfo.ERROR_VALUE_7); log.debug("Sending PCEP-ERROR message to PCC."); controller.peerExceptions(peerAddr, e.getCause().toString()); channel.write(Collections.singletonList(errMsg)); channel.close(); state = ChannelState.INIT; return; } } else if (e.getCause() instanceof ClosedChannelException) { controller.peerExceptions(peerAddr, e.getCause().toString()); log.debug("Channel for pc {} already closed", getClientInfoString()); } else if (e.getCause() instanceof IOException) { controller.peerExceptions(peerAddr, e.getCause().toString()); log.error("Disconnecting client {} due to IO Error: {}", getClientInfoString(), e.getCause().getMessage()); if (log.isDebugEnabled()) { // still print stack trace if debug is enabled log.debug("StackTrace for previous Exception: ", e.getCause()); } channel.close(); } else if (e.getCause() instanceof PcepParseException) { controller.peerExceptions(peerAddr, e.getCause().toString()); PcepParseException errMsgParse = (PcepParseException) e.getCause(); byte errorType = errMsgParse.getErrorType(); byte errorValue = errMsgParse.getErrorValue(); if ((errorType == (byte) 0x0) && (errorValue == (byte) 0x0)) { processUnknownMsg(); } else { errMsg = getErrorMsg(errorType, errorValue); log.debug("Sending PCEP-ERROR message to PCC."); channel.write(Collections.singletonList(errMsg)); } } else if (e.getCause() instanceof RejectedExecutionException) { log.warn("Could not process message: queue full"); controller.peerExceptions(peerAddr, e.getCause().toString()); } else { log.error("Error while processing message from client " + getClientInfoString() + "state " + this.state); controller.peerExceptions(peerAddr, e.getCause().toString()); channel.close(); } }