Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-12443

Inefficient locking in the TopologyUpdater class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Meridian-2019.1.1, 25.1.1
    • Fix Version/s: Meridian-2019.1.3, 25.2.0
    • Component/s: None
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None
    • Sprint:
      Horizon 2019 - December 11th, Horizon 2020 - January 8th, Horizon 2020 - January 22nd

      Description

      Found ALEC blocked on the following stack when using the direct datasource:

      "ALEC Inventory Datasource Initializer" #809 prio=5 os_prio=0 tid=0x00007f7b59f06800 nid=0x194fd waiting for monitor entry [0x00007f7abb6ac000]
         java.lang.Thread.State: BLOCKED (on object monitor)
              at org.opennms.netmgt.enlinkd.common.TopologyUpdater.getTopology(TopologyUpdater.java:221)
              - waiting to lock <0x00000005d01f3030> (a org.opennms.netmgt.enlinkd.BridgeOnmsTopologyUpdater)
              at org.opennms.netmgt.topologies.service.impl.OnmsTopologyDaoInMemoryImpl.lambda$getTopologies$0(OnmsTopologyDaoInMemoryImpl.java:64)
              at org.opennms.netmgt.topologies.service.impl.OnmsTopologyDaoInMemoryImpl$$Lambda$1103/1488677422.accept(Unknown Source)
              at java.util.HashMap.forEach(HashMap.java:1288)
              at org.opennms.netmgt.topologies.service.impl.OnmsTopologyDaoInMemoryImpl.getTopologies(OnmsTopologyDaoInMemoryImpl.java:64)
              - locked <0x00000005c3f75178> (a java.util.HashMap)
              at Proxy51f48aff_5cde_4f2a_be3b_c19d52f4242e.getTopologies(Unknown Source)
              at org.opennms.features.apilayer.topology.EdgeDaoImpl.getEdges(EdgeDaoImpl.java:73)
              at org.opennms.features.apilayer.topology.EdgeDaoImpl.getEdges(EdgeDaoImpl.java:99)
              at Proxy76adca50_253d_4e68_8905_1fc31437048e.getEdges(Unknown Source)
              at org.opennms.alec.datasource.opennms.jvm.DirectInventoryDatasource.doInit(DirectInventoryDatasource.java:256)
              at org.opennms.alec.datasource.opennms.jvm.DirectInventoryDatasource.lambda$initAsync$0(DirectInventoryDatasource.java:222)
              at org.opennms.alec.datasource.opennms.jvm.DirectInventoryDatasource$$Lambda$1070/1722315937.run(Unknown Source)
              at java.lang.Thread.run(Thread.java:745)
      

      getTopology is defined as:

      @Override
      public synchronized OnmsTopology getTopology() {
          return m_topology.clone();
      }
      

      The runDiscovery method is also synchronized:

          @Override
          public synchronized void runDiscovery() {
      

      Meaning that calls to retrieve the current topology are completely blocked until discovery completes.

        Attachments

          Activity

            People

            Assignee:
            mvr Markus von RĂ¼den
            Reporter:
            j-white Jesse White
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: