Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3738

NPE in ListenSyslog processor when datagram size is zero

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.2.0
    • Component/s: Core Framework
    • Labels:
      None
    • Environment:
      java version Oracle 1.8.0_51
      linux 2.6.32-573.7.1.el6.x86_64

      Description

      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]

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alopresto Andy LoPresto
                Reporter:
                radder5 Conrad Crampton
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: