Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-3186

Fix null pointer exception when tallying snapshots

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 2025-02-12 - API
    • None
    • swatch-tally
    • None

      We're hitting the following null pointer exception in production:

      2024-12-09 12:50:56,472 [thread=rhsm-subscriptions-task-processor-0-C-1] [ERROR] [org.candlepin.subscriptions.tally.TallySnapshotController] - Error collecting existing usage snapshots 
      java.lang.NullPointerException: Cannot invoke "String.compareTo(String)" because the return value of "com.google.common.collect.PeekingIterator.peek()" is null
              at org.candlepin.subscriptions.tally.InventorySwatchDataCollator.trackActiveHypervisor(InventorySwatchDataCollator.java:192)
              at org.candlepin.subscriptions.tally.InventorySwatchDataCollator.collateData(InventorySwatchDataCollator.java:154)
              at org.candlepin.subscriptions.tally.InventoryAccountUsageCollector.reconcileSystemDataWithHbi(InventoryAccountUsageCollector.java:134)
              at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
              at java.base/java.lang.reflect.Method.invoke(Method.java:580)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
      

      This is the root cause of the exceptions that we can see using the splunk query

      index=rh_rhsm namespace=rhsm-prod "Error collecting existing usage snapshots"

      . However, in splunk, the exception stack trace is hidden which needs to be investigated by SWATCH-3134.

      This can be reproduced locally by loading the hbi and swatch data and running the tally snapshots.

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Diego de Oliveira Maranhao Diego de Oliveira Maranhao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: