Exception in Linkd

Description

Exception in thread "Scheduler-Thread-5-of-5" java.lang.NullPointerException
at org.opennms.netmgt.linkd.DiscoveryLink.populateMacToAtInterface(DiscoveryLink.java:256)
at org.opennms.netmgt.linkd.DiscoveryLink.run(DiscoveryLink.java:210)
at org.opennms.netmgt.linkd.scheduler.Scheduler$1.run(Scheduler.java:203)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:107)
at java.lang.Thread.run(Thread.java:680)

Environment

in 1.11.2-SNAPSHOT on July 19

Acceptance / Success Criteria

None

Attachments

1

Lucidchart Diagrams

Activity

Antonio Russo July 20, 2012 at 1:40 PM

Matt try to change the default intervals:

<linkd-configuration threads="5" initial_sleep_time="3000"
snmp_poll_interval="3600000" discovery_link_interval="300000">

with:

<linkd-configuration threads="1" initial_sleep_time="3000"
snmp_poll_interval="600000" discovery_link_interval="300000">

threads = 1 so it is easy to debug and maybe the discovery link interval is not run while there are still
threads running snmpCollection

this will perform the snmp collection every 10 minutes and then after 5 minutes try to run (every 10 minutes in any way) the topology discovery

Antonio Russo July 20, 2012 at 1:34 PM

MacBook-Pro-di-Antonio-Russo:opennms antonio$ git diff
diff --git a/opennms-services/src/main/java/org/opennms/netmgt/linkd/DiscoveryLink.java b/openn
index cf6dfe1..9a2a8f4 100644
— a/opennms-services/src/main/java/org/opennms/netmgt/linkd/DiscoveryLink.java
+++ b/opennms-services/src/main/java/org/opennms/netmgt/linkd/DiscoveryLink.java
@@ -253,7 +253,10 @@ public final class DiscoveryLink implements ReadyRunnable {

protected void populateMacToAtInterface() {
LogUtils.debugf(this, "populateMacToAtInterface: using atNodes to populate macToAtinte

  • for (final String macAddress : getLinkd().getAtInterfaces(getPackageName()).keySet())
    + final Map<String,List<AtInterface>> macs=getLinkd().getAtInterfaces(getPackageName());
    + if (macs== null || macs.keySet() == null )
    + return;
    + for (final String macAddress : macs.keySet()) {
    LogUtils.debugf(this, "populateMacToAtInterface: MAC %s now has atinterface refere
    for (final AtInterface at : getLinkd().getAtInterfaces(getPackageName()).get(macAd
    int nodeid = at.getNodeid();
    MacBook-Pro-di-Antonio-Russo:opennms antonio$ git commit -a
    [master 97af2c9] Fixed Exception in Linkd
    1 files changed, 4 insertions, 1 deletions
    MacBook-Pro-di-Antonio-Russo:opennms antonio$ git push
    Password:
    Counting objects: 21, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (9/9), done.
    Writing objects: 100% (11/11), 1.03 KiB, done.
    Total 11 (delta 5), reused 0 (delta 0)
    To ssh://rssntn67@opennms.git.sourceforge.net/gitroot/opennms/opennms
    c2815d3..97af2c9 master -> master

Matt Brozowski July 20, 2012 at 10:27 AM

The Linkd configuration i was using when I hit this.

Antonio Russo July 20, 2012 at 3:38 AM

eheh. Clearly cannot exists....
so I'll fix with a "control" to verify it is not null.

I'd like to get the linkd configuration and also the logs...

Antonio Russo July 20, 2012 at 3:35 AM

This method is the problem...

public Map<String, List<AtInterface>> getAtInterfaces(String packageName) {
return m_macToAtinterface.get(packageName);
}

could return null if the m_macToAtInterface has no key for packageName.....
but I remember that for every package there is a key....

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

PagerDuty

Created July 19, 2012 at 11:40 AM
Updated January 27, 2017 at 4:20 PM
Resolved July 20, 2012 at 1:34 PM