New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log exceptions in the netty channel pipeline #1340

Merged
merged 1 commit into from Aug 5, 2015

Conversation

Projects
None yet
2 participants
@bernd
Member

bernd commented Aug 4, 2015

This will help debugging channel handler problems in the future.

Log exceptions in the netty channel pipeline
This will help debugging channel handler problems in the future.

@bernd bernd added this to the 1.2.0 milestone Aug 4, 2015

@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
log.error("Error on Input [" + input.getName() + "/" + input.getId() + "] (channel "
+ e.getChannel().toString() + ")", e.getCause());

This comment has been minimized.

@joschi

joschi Aug 5, 2015

Contributor

Would it make sense to log the inner most exception (with Throwables#getRootCause(java.lang.Throwable))?

This comment has been minimized.

@bernd

bernd Aug 5, 2015

Member

In #1105 the error message looked like this:

2015-08-04 17:30:37,729 ERROR: org.graylog2.plugin.inputs.transports.NettyTransport - Error on Input [Syslog TCP/55c0b1cf0c744fd8e91c8958] (channel [id: 0xa6d26be2, /10.0.0.1:34500 :> /10.0.0.2:1514])
java.lang.IndexOutOfBoundsException: Too many bytes to read - Needs 16450, maximum is 16446 or 171
    at org.jboss.netty.buffer.CompositeChannelBuffer.getBytes(CompositeChannelBuffer.java:232)
    at org.jboss.netty.buffer.HeapChannelBuffer.setBytes(HeapChannelBuffer.java:127)
    at org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:467)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.extractFrame(FrameDecoder.java:567)
    at org.graylog2.inputs.syslog.tcp.SyslogOctetCountFrameDecoder.decode(SyslogOctetCountFrameDecoder.java:55)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:310)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.graylog2.inputs.syslog.tcp.SyslogTCPFramingRouterHandler.messageReceived(SyslogTCPFramingRouterHandler.java:53)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
[...]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
2015-08-04 17:30:37,729 ERROR: org.graylog2.plugin.inputs.transports.NettyTransport - Error in channel [id: 0xa6d26be2, /10.0.0.1:34500 :> /10.0.0.2:1514]
java.lang.NumberFormatException: For input string: "<45>1"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at java.lang.Integer.parseInt(Integer.java:527)
    at org.graylog2.inputs.syslog.tcp.SyslogOctetCountFrameDecoder.decode(SyslogOctetCountFrameDecoder.java:44)

The first exception actually helped to debug the problem so I guess it's fine as it is.

This comment has been minimized.

@joschi

joschi Aug 5, 2015

Contributor

@joschi joschi self-assigned this Aug 5, 2015

@joschi

This comment has been minimized.

Contributor

joschi commented Aug 5, 2015

LGTM. :shipit:

joschi added a commit that referenced this pull request Aug 5, 2015

Merge pull request #1340 from Graylog2/feature-netty-exception-logger
Log exceptions in the Netty channel pipeline

@joschi joschi merged commit 3ccad1a into master Aug 5, 2015

2 checks passed

ci Jenkins build graylog2-server-integration-pr 102 has succeeded
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@joschi joschi deleted the feature-netty-exception-logger branch Aug 5, 2015

joschi added a commit that referenced this pull request Aug 6, 2015

Merge pull request #1340 from Graylog2/feature-netty-exception-logger
Log exceptions in the Netty channel pipeline
(cherry picked from commit 3ccad1a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment