ambari icon indicating copy to clipboard operation
ambari copied to clipboard

AMBARI-25483 Web alert triggers a wrong critical alert in kerberized cluster

Open xihuanbanku opened this issue 5 years ago • 3 comments

Python use function time.time() get current time the unit is second, but we need a millisecond here.

What changes were proposed in this pull request?

When a kerberized "WEB" type alert checks its status with kinit for the very first time. It will create a cache file with command "kinit -c /path/to/tmp/cache -kt /path/to/keytab/file some-principal", next time the alert executes, it will check the cache file status first, which checks the difference between current timestamp and last kinit timestamp. But when compare these two timestamps, we should use "millisecond" unit, not "second". From the variable name of kinit_timer_ms we also could firgure is out. Otherwise, the "if" statement at line 128 will never return True after 14400000 seconds(166.66 days) later.

How was this patch tested?

manual tests

xihuanbanku avatar Feb 21 '20 15:02 xihuanbanku

@xihuanbanku please file an Apache jira ticket and use it in the commit msg

g-boros avatar Feb 24 '20 11:02 g-boros

@g-boros https://issues.apache.org/jira/browse/AMBARI-25483

xihuanbanku avatar Feb 25 '20 02:02 xihuanbanku

The change suggestion is ok, it seems that comments assume that time.time() return milis and .. it is but in form of float number, where on some systems resolution would be higher or not.

Any usage of the mentioned function should be fixed.

hapylestat avatar Jul 24 '20 22:07 hapylestat