Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Handling of Duplicate Registry Entries #3183

Open
davidraker opened this issue May 17, 2024 · 0 comments
Open

Inconsistent Handling of Duplicate Registry Entries #3183

davidraker opened this issue May 17, 2024 · 0 comments
Assignees

Comments

@davidraker
Copy link
Contributor

Describe the bug

When a registry file has multiple entries with the same Volttron Point Name field:

  1. The driver silently discards the register created from the first row, replacing it with the duplicate
  2. The web API, when parsing device configurations, returns an error that a node with the topic ending in the duplicate point name cannot be created.

In the first case, if other fields in the registry rows do not match, this may lead to unexpected behavior which the user should be made aware of (e.g., they think they are polling one point, but in fact are polling another). Raising an exception and stopping instantiation of a driver for this device might be merited, but could break existing deployments. A warning should probably, at least be logged.

In the second case, the error prevents the devices endpoint from working at all. The error should be caught and handled, with more meaningful error being logged. It may not be feasible, however, to both return an error to the user of the endpoint and to avoid raising the exception without changing the API. Probably, it should just result in a warning in the log (on the server side) without stopping the endpoint from completing its task (and thus not passing the error to the client).

To Reproduce
Create a fake (or other) driver with a duplicate point names in the registry table (the default fake driver config can be used with this):

Point Name,Volttron Point Name,Units,Units Details,Writable,Starting Value,Type,Notes
OutsideAirTemperature1,OutsideAirTemperature1,F,-100 to 300,FALSE,50,float,CO2 Reading 0.00-2000.0 ppm
OutsideAirTemperature1,OutsideAirTemperature1,F,-100 to 300,FALSE,500,float,CO2 Reading 0.00-2000.0 ppm

Start the driver, and observe that there are no warnings, but this is returned by the listener:

[{'OutsideAirTemperature1': 500.0},
{'OutsideAirTemperature1': {'type': 'integer',
'tz': 'US/Pacific',
'units': 'F'}}]

Expected behavior

  • Driver side: Something should at least alert the user of the malformed registry file. If these points referenced different registers on the device, it would not be clear to the user that one of the points was not polled, nor which was, in fact, polled.
  • Web side: A warning should be logged for the owner of the server, and the endpoint should ignore the duplicate name.

Additional context
This problem is not likely to occur in the new driver, since it uses TopicTree as an internal data structure. It will therefore be unable to ignore the duplicate entry without extra logic. It should still be checked to make sure it fails with a meaningful error to the user when loading the bad configuration.

@davidraker davidraker self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant