Skip to content

Devices are not properly cleaned when duplicate addresses are present #560

@aacuevas

Description

@aacuevas

Consider the following situation:

Image

Where both PersistentHeartbeat devices are configured to the same address (e.g.: 0), but named differently. For example HB1 and HB2 respectively.

As it is expected it throws an error on the HB2 node, since addresses are duplicated:

Image

If after this situation we remove the duplication and leave only a node called HB1 (or anything else), the workflow would work. But if we named the node HB2 (or, specifically, the name that the node that threw the duplicate address exception had), then we get this same error, even if it is the only configure node trying to access this address.

I am pretty sure the issue lays inside this check:

if (info.Context == deviceInfo.Context && info.DeviceAddress == deviceInfo.DeviceAddress)

Which throws an exception whenever there is a duplicate address. However, this block does not call dispose on the element created on

var disposable = RegisterDevice(name);

which causes the name of the offending node to be stuck on the dictionary, not being clean.

I am pretty sure simply calling disposable.Dispose() before the throw should clean the object and remove it from the dictionary. But I am writing this report just in case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions