openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
154 stars 131 forks source link

Health populating mechanism populates statuses incorrectly #208

Closed karwojcie closed 3 years ago

karwojcie commented 3 years ago

Describe the bug Health populating mechanism (redfish-core/lib/health.hpp) should not populate health statuses from objects just by looking at their beginning with boost::starts_with. Standard use case is collecting information from objects such as 'OBJECT_PATH/warning' and matching them with 'OBJECT_PATH' because the status object started with the same string. This leads to objects finished by their id number populating incorrectly, such as '.../dimm2' being counted as an another receiver of data from object '.../dimm21/warning' due to identical beginning therefore unwantedly inheriting its health statuses. Issue has its source at line 59 in redfish-core/lib/health.hpp where both are recognised as isSelf == true.

Environment BMCWeb commit 7e860f1550c8686eec42f7a75bc5f2ef51e756ad

To Reproduce I am not entirely sure if any object being numered in the way described above which would create a problem is currently managed by this health populating mechanism. It is bound to happen after progressing with e.g. redfish-core/lib/memory.hpp changes where health status is currently fixed to 'OK'. Therefore, to see the problem proceed with following steps:

Is this a regression No

edtanous commented 3 years ago

This is an example of common error #12.

https://github.com/openbmc/bmcweb/blob/master/COMMON_ERRORS.md#12-imprecise-matching

Happy to help review any patchset to fix this behavior.