Bug 1653773 - Thread terminated due to uncaught null pointer exception
Summary: Thread terminated due to uncaught null pointer exception
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: opendaylight
Version: 13.0 (Queens)
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: lpeer
QA Contact: Noam Manos
Depends On:
TreeView+ depends on / blocked
Reported: 2018-11-27 15:45 UTC by Sai Sindhur Malleni
Modified: 2020-07-10 13:12 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-12-17 10:16:55 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Sai Sindhur Malleni 2018-11-27 15:45:35 UTC
Description of problem:
In a clustered ODL+OSP environment, we are seeing the following in logs
2018-11-27T15:38:46,408 | ERROR | org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation_AsyncClusteredDataTreeChangeListenerBase-DataTreeChangeHandler-325593 | AsyncClusteredDataTreeChangeListenerBase | 261 - org.opendaylight.genius.mdsalutil-api - 0.4.4.redhat-4 | Thread terminated due to uncaught exception: org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation_AsyncClusteredDataTreeChangeListenerBase-DataTreeChangeHandler-325593
java.lang.NullPointerException: null
        at org.opendaylight.genius.interfacemanager.InterfacemgrProvider.addBridgeForNodeIid(InterfacemgrProvider.java:670) [255:org.opendaylight.genius.interfacemanager-impl:0.4.4.redhat-4]
        at org.opendaylight.genius.interfacemanager.listeners.InterfaceTopologyStateListener.update(InterfaceTopologyStateListener.java:135) [255:org.opendaylight.genius.interfacemanager-impl:0.4.4.redhat-4]
        at org.opendaylight.genius.interfacemanager.listeners.InterfaceTopologyStateListener.update(InterfaceTopologyStateListener.java:47) [255:org.opendaylight.genius.interfacemanager-impl:0.4.4.redhat-4]
        at org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase$DataTreeChangeHandler.run(AsyncClusteredDataTreeChangeListenerBase.java:154) [261:org.opendaylight.genius.mdsalutil-api:0.4.4.redhat-4]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Deploy OSP+ODL clustered setup
2. Run some load tests to stress the system
3. Look at logs

Actual results:
NullPointer exceptions

Expected results:
No exceptions

Additional info:

Comment 1 Josh Hershberg 2018-11-29 08:44:56 UTC
This exception happens here:
    public void addBridgeForNodeIid(InstanceIdentifier<Node> nodeIid, OvsdbBridgeAugmentation bridge) {
        if (nodeIid != null && bridge != null) {
            nodeIidToBridgeMap.put(nodeIid, bridge);

It would seem the only way this can happen is if nodeIidToBridgeMap is null. nodeIidToEtc is initialized here:

    public void start() {
        try {
            configEntityCandidate = entityOwnershipService.registerCandidate(
                    new Entity(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY));
            bindingEntityCandidate = entityOwnershipService.registerCandidate(
                    new Entity(IfmConstants.INTERFACE_SERVICE_BINDING_ENTITY,
            this.ifaceToTpMap = new ConcurrentHashMap<>();
            this.ifaceToNodeIidMap = new ConcurrentHashMap<>();
            this.nodeIidToBridgeMap = new ConcurrentHashMap<>();
            LOG.info("InterfacemgrProvider Started");
        } catch (CandidateAlreadyRegisteredException e) {
            LOG.error("Failed to register entity {} with EntityOwnershipService", e.getEntity());
        } catch (InterruptedException | ExecutionException e) {
            LOG.error("Failed to create idPool for InterfaceMgr", e);

If an exception is thrown in the first three lines of the try block the hash maps will never be initialized. Can you please check if any of the LOG.error messages are present higher up in the log? Also, please check for "InterfacemgrProvider Started"?

NB: In general there is no reason for the hash map initializations to be in the try block. A patch should be raised to move them.

Comment 2 Mike Kolesnik 2018-12-03 11:46:59 UTC
Sai, can you please attach the relevant logs from when this happened?

Comment 3 Mike Kolesnik 2018-12-17 10:16:55 UTC
Closing since there are no logs attached.

Please attach the relevant logs and reopen the bug should you encounter it again.

Note You need to log in before you can comment on or make changes to this bug.