View Issue Details

IDProjectCategoryView StatusLast Update
2053RackTablesdefaultpublic2022-02-13 13:27
Reporterkylemaas Assigned Toinfrastation  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionno change required 
Product Version0.21.5 
Summary2053: Lowercase L2 addresses cause Internal Error
DescriptionWhen migrating from an older version of RackTables, when I tried to open certain objects, I would get the following error:

Argument 'string' of value '************' is invalid (invalid format).

(Actual string starred out because it's an actual device's MAC address, all lowercase.) Turns out that RackTables's validation only allows uppercase MAC addresses now. See line throwing exception here:

https://github.com/RackTables/racktables/blob/a70c4ead4d3c59fbfcaed0ddb6f233a3ba41ca44/wwwroot/inc/functions.php#L1077

And RegEx here:

https://github.com/RackTables/racktables/blob/a70c4ead4d3c59fbfcaed0ddb6f233a3ba41ca44/wwwroot/inc/functions.php#L43

This is probably only a problem when migrating from an older version of RackTables. But I did have to debug it, so I figured I'd better report it.
Steps To ReproduceRun the following SQL on a live database:

UPDATE Port SET l2address=LOWER(l2address);

This triggers the error. To fix it, run this:

UPDATE Port SET l2address=UPPER(l2address);

And the error goes away.
TagsNo tags attached.

Activities

infrastation

infrastation

2022-02-03 21:45

administrator   ~0004373

RackTables since the very first public release stores L2 addresses as upper case hex strings, so the lower case data is likely an effect of a direct INSERT. Before 0.21.0 RackTables did not check whether the data it read from the database comes in upper case, so the inconsistency could remain hidden with a potential to manifest elsewhere. In the current implementation the invalid data format triggers an immediate exception, which is the intended behaviour.

This way, the only thing that needs to be done in this case is to remind that 3rd party software should not access RackTables database directly, there is the internal PHP API for that.
kylemaas

kylemaas

2022-02-03 22:23

reporter   ~0004375

We don't have any third party software interacting with the database and always added data through the UI. I suspect there must have been a bug at some point that was already fixed which allowed it to be inserted through the UI, as we have not seen this issue with any hosts added after upgrading to 0.21.5. But it'd be nice if one of the following was present:

* There was a more descriptive error message
* Something that autocorrects the data upon upgrading from an older version
* Something that autocorrects the data when viewing it, similar to how colons are added to L2 addresses
* Selecting UPPER(l2address) just to make sure it's in a format that's expected

It would have made debugging this much easier, since it was not apparent from the error message that this was an L2 address. It just looked like a random hex string, being all lowercase with no colons.
infrastation

infrastation

2022-02-04 00:04

administrator   ~0004379

Thank you for the feedback. It could indeed be a bug in old RackTables versions, or could be something else. The post-upgrade diagnostics would be a bit easier using the data integrity report, which includes a check for this specific anomaly ("L2 address invalid characters"). You can try it and see if it flags anything else.

Regarding using UPPER() for this data column, let me mention that it would not be a correct solution without going into too much technical detail.
kylemaas

kylemaas

2022-02-04 14:16

reporter   ~0004381

Where do I find that information?
infrastation

infrastation

2022-02-04 14:36

administrator   ~0004383

main page -> reports -> data integrity
infrastation

infrastation

2022-02-06 14:33

administrator   ~0004385

Is there anything else that remains to be done in the scope of this request?
infrastation

infrastation

2022-02-13 13:27

administrator   ~0004387

Alright, closing as resolved then.

Issue History

Date Modified Username Field Change
2022-02-03 21:22 kylemaas New Issue
2022-02-03 21:45 infrastation Note Added: 0004373
2022-02-03 22:23 kylemaas Note Added: 0004375
2022-02-04 00:04 infrastation Note Added: 0004379
2022-02-04 14:16 kylemaas Note Added: 0004381
2022-02-04 14:36 infrastation Note Added: 0004383
2022-02-06 14:33 infrastation Note Added: 0004385
2022-02-13 13:27 infrastation Assigned To => infrastation
2022-02-13 13:27 infrastation Status new => closed
2022-02-13 13:27 infrastation Resolution open => no change required
2022-02-13 13:27 infrastation Note Added: 0004387