Open fgalan opened 3 years ago
Looking this in detail:
The alarm is raised at this point:
it is relevant level 8 in the call stack:
The alarm is released at this point:
it is relevant level 2 in the call stack:
In restService() (restService.cpp) we have:
//
// If we have gotten this far the Input is OK.
// Except for all the badVerb/badRequest, in the restBadVerbV vector.
//
// So, the 'Bad Input' alarm is cleared for this client.
//
if (serviceV != restBadVerbV)
{
alarmMgr.badInputReset(clientIp);
}
std::string response = serviceV[ix].treat(ciP, components, compV, &parseData);
So the problem is that alarmMgr.badInputReset(clientIp);
is assumed too early (only checking that we are not in a badVerb situation) but the serviceV[ix].treat(ciP, components, compV, &parseData)
could raise alarms...
A possible solution could be to have a return parameter with the internal alarm situation, eg:
std::string response = serviceV[ix].treat(ciP, components, compV, &parseData, raisedAlarm);
if ((serviceV != restBadVerbV) && (!raisedAlarm))
{
alarmMgr.badInputReset(clientIp);
}
but passing-down that return parameters maybe is too complicated. A lot of signature functions (all service routine functions!) would need to change. It is not seem to be feasible.
Some other interesting facts:
but passing-down that return parameters maybe is too complicated. A lot of signature functions (all service routine functions!) would need to change. It is not seem to be feasible.
As alternative to signature modification, the ciP object (which is global) could be used to implement that "return parameter"
PR https://github.com/telefonicaid/fiware-orion/pull/3908 (although probably we are not going to uses it at the end)
Running test case
if we look to Context Broker traces looking for WARN level:
The first one (trans=...0009) is OK. An alarm is raised due to:
However, second one (trans=...0010) is NOK. It is caused by
However, given that the BadInput alarm for 0.0.0.0 is already raised we shouldn't see any new alarm-related trace. Instead of that we are getting a buggy release+raise "flapping" effect.