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

Andy LoPresto commented on NIFI-3738:
-------------------------------------

I do have a question -- are you able to capture any of the events that cause 
this exception? I've been using the test harness and if I send a message that 
is {{new byte[0]}} or {{"\n".getBytes()}} only, the parser correctly interprets 
this as a null message well before where the error is being thrown. If I send a 
message that is non-zero but just whitespace, it interprets it as an invalid 
message and routes it correctly to {{REL_INVALID}} with the message intact. 

> NPE in ListenSyslog processor when datagram size is zero
> --------------------------------------------------------
>
>                 Key: NIFI-3738
>                 URL: https://issues.apache.org/jira/browse/NIFI-3738
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.1.1
>         Environment: java version Oracle 1.8.0_51
> linux 2.6.32-573.7.1.el6.x86_64
>            Reporter: Conrad Crampton
>            Assignee: Andy LoPresto
>            Priority: Minor
>
> I have a 6 node cluster with an F5 load balancer in front to distribute UDP 
> syslog load. It splits an incoming syslog stream and sends separate lines to 
> each node in the cluster (I am checking if zero length datagrams are being 
> sent from the F5 LB). However, from Bryan Bende from user mailing lists
> >>>
> Line 431 of ListenSyslog has the following code:
> if (!valid || !event.isValid())
> So to get an NPE there means event must be null, and event comes from this 
> code:
> boolean valid = true;
> try {
>     event = parser.parseEvent(rawSyslogEvent.getData(), sender);
> } catch (final ProcessException pe) {
>     getLogger().warn("Failed to parse Syslog event; routing to invalid");
>     valid = false;
> }
> The parser returns null if the bytes sent in are null or length 0.
> We should be checking if (!valid || event == null || !event.isValid())
> to avoid this case, and I think a similar situation exists in the
> ParseSyslog processor. It appears this would only happen if parsing
> messages is enabled in ListenSyslog.
> <<<<
> and log file snippet is 
> 2017-04-25 17:43:07,549 ERROR [Timer-Driven Process Thread-2] 
> o.a.n.processors.standard.ListenSyslog 
> ListenSyslog[id=0a932c37-0158-1000-0000-0000656754bf] 
> ListenSyslog[id=0a932c37-0158-1000-0000-0000656754bf] failed to process 
> session due to java.lang.NullPointerException: java.lang.NullPointerException
> 2017-04-25 17:43:07,550 ERROR [Timer-Driven Process Thread-2] 
> o.a.n.processors.standard.ListenSyslog
> java.lang.NullPointerException: null
>         at 
> org.apache.nifi.processors.standard.ListenSyslog.onTrigger(ListenSyslog.java:431)
>  ~[na:na]
>         at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>  ~[nifi-api-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099)
>  ~[nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
> [na:1.8.0_51]
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) 
> [na:1.8.0_51]
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [na:1.8.0_51]
>         at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]
> 2017-04-25 17:43:07,550 WARN [Timer-Driven Process Thread-2] 
> o.a.n.processors.standard.ListenSyslog 
> ListenSyslog[id=0a932c37-0158-1000-0000-0000656754bf] Processor 
> Administratively Yielded for 1 sec due to processing failure
> 2017-04-25 17:43:07,550 WARN [Timer-Driven Process Thread-2] 
> o.a.n.c.t.ContinuallyRunProcessorTask Administratively Yielding 
> ListenSyslog[id=0a932c37-0158-1000-0000-0000656754bf] due to uncaught 
> Exception: java.lang.NullPointerException
> 2017-04-25 17:43:07,551 WARN [Timer-Driven Process Thread-2] 
> o.a.n.c.t.ContinuallyRunProcessorTask
> java.lang.NullPointerException: null
>         at 
> org.apache.nifi.processors.standard.ListenSyslog.onTrigger(ListenSyslog.java:431)
>  ~[na:na]
>         at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>  ~[nifi-api-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099)
>  ~[nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
>  [nifi-framework-core-1.1.2.jar:1.1.2]
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
> [na:1.8.0_51]
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) 
> [na:1.8.0_51]
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [na:1.8.0_51]
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [na:1.8.0_51]
>         at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to