[L2SWITCH-57] NullPointerException in HostTracker.java Created: 16/Jan/16  Updated: 19/Oct/17  Resolved: 25/May/16

Status: Resolved
Project: l2switch
Component/s: General
Affects Version/s: unspecified
Fix Version/s: None

Type: Bug
Reporter: lei xu Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 4983
Priority: Low

 Description   

Two buggy sites may raise NullPointerException in HostTracker module if concurrent remove operation occurs.

The first case is for "transHost" variable, if a concurrent remove upon "hostsDB" variable. The corresponding snippets are attached:

HostNodeConnector transHost = hostsDB.get(networkAddr);
transHost.setStaticHost(true);

The second case is for "existinghost" variable. The following are snippets:

HostNodeConnector existinghost = hostsDB.get(id);
existinghost.initArpSendCountDown();

To solve the issue, the simplest way is to add a null checker for these variable since we cannot guarantee the result from hostsDB is not NULL.



 Comments   
Comment by Suvitha Balu [ 19/May/16 ]

(In reply to lei xu from comment #0)
> Two buggy sites may raise NullPointerException in HostTracker module if
> concurrent remove operation occurs.
>
> The first case is for "transHost" variable, if a concurrent remove upon
> "hostsDB" variable. The corresponding snippets are attached:
>
> HostNodeConnector transHost = hostsDB.get(networkAddr);
> transHost.setStaticHost(true);
>
> The second case is for "existinghost" variable. The following are snippets:
>
> HostNodeConnector existinghost = hostsDB.get(id);
> existinghost.initArpSendCountDown();
>
> To solve the issue, the simplest way is to add a null checker for these
> variable since we cannot guarantee the result from hostsDB is not NULL.

Hi,

I would like to take up this bug, so could you please provide me the more details.

Thanks,
Suvitha Balu

Comment by lei xu [ 19/May/16 ]

Hi Suvitha Balu,

I have checked the latest sorce code of HostTracker.java in
https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/controller/hosttracker.implementation/0.6.5-SNAPSHOT/

It seems the concurrency bugs are still there.

First, in the line of 547 and 548,
545: if (hostExists(host)) {
...
547: HostNodeConnector existinghost = hostsDB.get(id);
548: existinghost.initArpSendCountDown();
The Line 545 cannot guarantee the id is in hostsDB, in the case, I think we can use the same reference in line 545 and 547, for example,
h = hostsDB.get(id)
545: if (h != null){

Comment by Suvitha Balu [ 20/May/16 ]

Hi Lei,
Thanks for the information.

I have checked-out the ODL Origin/master controller and L2switch code and could not find the HostTracker.java file. Is the part of any new feature or specific to any release?

Comment by Colin Dixon [ 25/May/16 ]

This appears to be referring to the now-defunct HostTracker that used to be in the controller using the AD-SAL. The AD-SAL was completely removed in Beryllium and the recommendation is to use the Host Tracker in the l2switch project as described here:
https://wiki.opendaylight.org/view/L2_Switch:HostTracker

You should be able to install it by installing the Karaf feature for odl-l2switch-hosttracker.

Generated at Wed Feb 07 20:05:49 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.