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

Mubashir Kazia commented on FLUME-2271:
---------------------------------------

Yes looks like the patch in FLUME-2186 trying to solve the same problem. The 
solution there is doing 2 things.
1. Trying a reconnect if the rpcClient is null and it is in unsafe mode.
2. Checking for null rpcClient before calling append on rpcClient.

My patch here does only the second, but it checks for null and bails out soon 
after the reconnect is executed because that this the cause of rpcClient 
becoming null after it entered the append method with non-null value. So in 
FLUME-2186 patch if rpcClient was still null after reconnect is executed you 
are simply setting up the Event without using it.

> Log4j appender source can cause NullPointerException even in Unsafe mode
> ------------------------------------------------------------------------
>
>                 Key: FLUME-2271
>                 URL: https://issues.apache.org/jira/browse/FLUME-2271
>             Project: Flume
>          Issue Type: Bug
>          Components: Client SDK
>    Affects Versions: v1.4.0
>            Reporter: Mubashir Kazia
>         Attachments: FLUME-2271.patch
>
>
> If a client program is configured to use Log4J appender in unsafe mode and if 
> the source was available when the client program started but became 
> unavailable afterwards, Log4J appender can cause a NullPointerException. The 
> stack trace is as follows.
> 2013-12-11 15:20:36,619 ERROR [STDERR] (Thread-23) Exception in thread 
> "Thread-23"
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23) 
> java.lang.NullPointerException
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.flume.clients.log4jappender.Log4jAppender.append(Log4jAppender.java:163)
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.log4j.Category.callAppenders(Category.java:203)
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.log4j.Category.forcedLog(Category.java:388)
> 2013-12-11 15:20:36,620 ERROR [STDERR] (Thread-23)      at 
> org.apache.log4j.Category.log(Category.java:853)
> I have developed a fix that'll will address this problem. I'll attach the 
> patch shortly.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to