Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-11588

MessageFetcher inappropriately throws NoSuchElementException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.0
    • Component/s: Messaging
    • Labels:
      None
    • Release Notes:
      Fixed a bug in TMS that fetching from the payload table raised exception if the fetch has empty result
    • Rank:
      1|i001xj:

      Description

      Calling hasNext on the iterator returned by MessageFetcher can throw the exception below. Calling hasNext should never throw such an exception.
      The faulty code is likely in AbstractPayloadTable (around lines 94-97).

      Caused by: java.util.NoSuchElementException: null
      	at co.cask.cdap.api.dataset.lib.AbstractCloseableIterator.next(AbstractCloseableIterator.java:120) ~[na:na]
      	at co.cask.cdap.messaging.store.AbstractPayloadTable$1.computeNext(AbstractPayloadTable.java:97) ~[na:na]
      	at co.cask.cdap.messaging.store.AbstractPayloadTable$1.computeNext(AbstractPayloadTable.java:78) ~[na:na]
      	at co.cask.cdap.api.dataset.lib.AbstractCloseableIterator.tryToComputeNext(AbstractCloseableIterator.java:109) ~[na:na]
      	at co.cask.cdap.api.dataset.lib.AbstractCloseableIterator.hasNext(AbstractCloseableIterator.java:104) ~[na:na]
      	at co.cask.cdap.messaging.service.CoreMessageFetcher$MessageCloseableIterator.hasNext(CoreMessageFetcher.java:168) ~[na:na]
      	at co.cask.cdap.internal.app.runtime.messaging.MessageIterator.computeNext(MessageIterator.java:41) ~[na:na]
      	at co.cask.cdap.internal.app.runtime.messaging.MessageIterator.computeNext(MessageIterator.java:31) ~[na:na]
      	at co.cask.cdap.api.dataset.lib.AbstractCloseableIterator.tryToComputeNext(AbstractCloseableIterator.java:109) ~[na:na]
      	at co.cask.cdap.api.dataset.lib.AbstractCloseableIterator.hasNext(AbstractCloseableIterator.java:104) ~[na:na]
      	at co.cask.cdap.scheduler.NotificationSubscriberService$NotificationSubscriberThread.fetchAndProcessNotifications(NotificationSubscriberService.java:226) [na:na]
      	at co.cask.cdap.scheduler.NotificationSubscriberService$NotificationSubscriberThread.access$600(NotificationSubscriberService.java:142) [na:na]
      	at co.cask.cdap.scheduler.NotificationSubscriberService$NotificationSubscriberThread$2.call(NotificationSubscriberService.java:201) ~[na:na]
      	at co.cask.cdap.scheduler.NotificationSubscriberService$NotificationSubscriberThread$2.call(NotificationSubscriberService.java:198) ~[na:na]
      	at co.cask.cdap.data2.transaction.Transactions$4.run(Transactions.java:262) ~[na:na]
      	at co.cask.cdap.data2.transaction.Transactions$CacheBasedTransactional.finishExecute(Transactions.java:235) ~[na:na]
      	... 11 common frames omitted
      

        Attachments

          Activity

            People

            • Assignee:
              terence Terence Yim
              Reporter:
              ali.anwar Ali Anwar
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: