Java Code Examples for io.netty.channel.unix.Errors#NativeIoException
The following examples show how to use
io.netty.channel.unix.Errors#NativeIoException .
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: ClientRequestReceiver.java From zuul with Apache License 2.0 | 6 votes |
private void fireWriteError(String requestPart, Throwable cause, ChannelHandlerContext ctx) throws Exception { final String errMesg = String.format("Error writing %s to client", requestPart); if (cause instanceof java.nio.channels.ClosedChannelException || cause instanceof Errors.NativeIoException) { LOG.info(errMesg + " - client connection is closed."); if (zuulRequest != null) { zuulRequest.getContext().cancel(); StatusCategoryUtils.storeStatusCategoryIfNotAlreadyFailure(zuulRequest.getContext(), ZuulStatusCategory.FAILURE_CLIENT_CANCELLED); } } else { LOG.error(errMesg, cause); ctx.fireExceptionCaught(new ZuulException(cause, errMesg, true)); } }
Example 2
Source File: SwallowSomeHttp2ExceptionsHandler.java From zuul with Apache License 2.0 | 6 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { incrementExceptionCounter(cause); if (cause instanceof Http2Exception) { Http2Exception h2e = (Http2Exception) cause; if (h2e.error() == Http2Error.NO_ERROR && Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN.equals(h2e.shutdownHint())) { // This is the exception we threw ourselves to make the http2 codec gracefully close the connection. So just // swallow it so that it doesn't propagate and get logged. LOG.debug("Swallowed Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN ", cause); } else { super.exceptionCaught(ctx, cause); } } else if (cause instanceof Errors.NativeIoException) { LOG.debug("Swallowed NativeIoException", cause); } else { super.exceptionCaught(ctx, cause); } }
Example 3
Source File: RpcServerHandler.java From brpc-java with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (ctx.channel().isActive() && !(cause instanceof Errors.NativeIoException) && !(cause instanceof IOException)) { log.info("service exception, ex={}", cause.getMessage()); } log.debug("meet exception, may be connection is closed, msg={}", cause.getMessage()); log.debug("remove from channel map"); ChannelManager.getInstance().removeChannel(ctx.channel()); ctx.close(); }
Example 4
Source File: PassportStateServerHandler.java From zuul with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { passport(ctx).add(PassportState.SERVER_CH_EXCEPTION); if (cause instanceof Errors.NativeIoException) { LOG.debug("PassportStateServerHandler Inbound NativeIoException " + cause); incrementExceptionCounter(cause, "PassportStateServerHandler.Inbound"); } else { super.exceptionCaught(ctx, cause); } }
Example 5
Source File: PassportStateServerHandler.java From zuul with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { passport(ctx).add(PassportState.SERVER_CH_EXCEPTION); if (cause instanceof Errors.NativeIoException) { LOG.debug("PassportStateServerHandler Outbound NativeIoException " + cause); incrementExceptionCounter(cause, "PassportStateServerHandler.Outbound"); } else { super.exceptionCaught(ctx, cause); } }
Example 6
Source File: NettyRequestAttemptFactory.java From zuul with Apache License 2.0 | 5 votes |
public ErrorType mapNettyToOutboundErrorType(final Throwable t) { if (t instanceof ReadTimeoutException) { return READ_TIMEOUT; } if (t instanceof OriginConcurrencyExceededException) { return ORIGIN_CONCURRENCY_EXCEEDED; } if (t instanceof OriginConnectException) { return ((OriginConnectException) t).getErrorType(); } if (t instanceof OutboundException) { return ((OutboundException) t).getOutboundErrorType(); } if (t instanceof Errors.NativeIoException && Errors.ERRNO_ECONNRESET_NEGATIVE == ((Errors.NativeIoException) t).expectedErr()) { // This is a "Connection reset by peer" which we see fairly often happening when Origin servers are overloaded. LOG.warn("ERRNO_ECONNRESET_NEGATIVE mapped to RESET_CONNECTION", t); return RESET_CONNECTION; } if (t instanceof ClosedChannelException) { return RESET_CONNECTION; } final Throwable cause = t.getCause(); if (cause instanceof IllegalStateException && cause.getMessage().contains("server")) { LOG.warn("IllegalStateException mapped to NO_AVAILABLE_SERVERS", cause); return NO_AVAILABLE_SERVERS; } return OTHER; }
Example 7
Source File: ZuulFilterChainHandler.java From zuul with Apache License 2.0 | 5 votes |
private boolean isClientChannelClosed(Throwable cause) { if (cause instanceof ClosedChannelException || cause instanceof Errors.NativeIoException) { LOG.error("ZuulFilterChainHandler::isClientChannelClosed - IO Exception"); return true; } return false; }