[ 
https://issues.apache.org/jira/browse/STORM-874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14976714#comment-14976714
 ] 

ASF GitHub Bot commented on STORM-874:
--------------------------------------

Github user d2r commented on a diff in the pull request:

    https://github.com/apache/storm/pull/597#discussion_r43150822
  
    --- Diff: 
storm-core/src/jvm/backtype/storm/messaging/netty/NettyUncaughtExceptionHandler.java
 ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package backtype.storm.messaging.netty;
    +
    +import backtype.storm.utils.Utils;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +public class NettyUncaughtExceptionHandler implements 
Thread.UncaughtExceptionHandler {
    +  private static final Logger LOG = 
LoggerFactory.getLogger(NettyUncaughtExceptionHandler.class);
    +  @Override
    +  public void uncaughtException(Thread t, Throwable e) {
    +    try {
    +      Utils.handleUncaughtException(e);
    --- End diff --
    
    Also, the name Utils/handleUncaughtException here implies we are handling 
exceptions that could not be otherwise be dealt with, and so this is the end of 
the road.  It does not seem that we should return from this handler expecting 
some other code to deal with the situation, but we should bring down the JVM or 
throw.  If the code is not intended to be used this way, then we should rename 
and/or document what is expected of the caller to do with `t` after we return.


> Netty Threads do not handle Errors properly
> -------------------------------------------
>
>                 Key: STORM-874
>                 URL: https://issues.apache.org/jira/browse/STORM-874
>             Project: Apache Storm
>          Issue Type: Bug
>          Components: storm-core
>    Affects Versions: 0.9.2-incubating, 0.10.0
>            Reporter: Kishor Patil
>
> When low on memory, netty thread could get OOM which if not handled correctly 
> can lead to unexpected behavior such as netty connection leaks.
> {code:java}
> java.lang.OutOfMemoryError: Direct buffer memory
>       at java.nio.Bits.reserveMemory(Bits.java:658) ~[?:1.8.0_25]
>       at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123) 
> ~[?:1.8.0_25]
>       at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311) ~[?:1.8.0_25]
>       at 
> org.jboss.netty.buffer.ChannelBuffers.directBuffer(ChannelBuffers.java:167) 
> ~[netty-3.9.4.Final.jar:?]
>       at 
> org.jboss.netty.buffer.ChannelBuffers.directBuffer(ChannelBuffers.java:151) 
> ~[netty-3.9.4.Final.jar:?]
>       at 
> backtype.storm.messaging.netty.MessageBatch.buffer(MessageBatch.java:101) 
> ~[storm-core-0.9.2-incubating-security.jar:0.9.2-incubating-security]
>       at 
> backtype.storm.messaging.netty.MessageEncoder.encode(MessageEncoder.java:32) 
> ~[storm-core-0.9.2-incubating-security.jar:0.9.2-incubating-security]
>       at 
> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.doEncode(OneToOneEncoder.java:66)
>  ~[netty-3.9.4.Final.jar:?]
>       at 
> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:59)
>  ~[netty-3.9.4.Final.jar:?]
>       at 
> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
>  ~[netty-3.9.4.Final.jar:?]
>       at 
> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)
>  ~[netty-3.9.4.Final.jar:?]
>       at org.jboss.netty.channel.Channels.write(Channels.java:704) 
> ~[netty-3.9.4.Final.jar:?]
>       at org.jboss.netty.channel.Channels.write(Channels.java:671) 
> ~[netty-3.9.4.Final.jar:?]
>       at 
> org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) 
> ~[netty-3.9.4.Final.jar:?]
>       at 
> backtype.storm.messaging.netty.Client.tryDeliverMessages(Client.java:226) 
> ~[storm-core-0.9.2-incubating-security.jar:0.9.2-incubating-security]
>       at backtype.storm.messaging.netty.Client.send(Client.java:173) 
> ~[storm-core-0.9.2-incubating-security.jar:0.9.2-incubating-security]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to