Details
-
Bug
-
Status: Complete
-
Medium
-
Resolution: Done
-
None
-
This is on the live sovrin network, running 1.3.62
-
EV 18.14 Monitoring/Stability
Description
validator-info is reading files which might be updated exactly when validator-info access them.
This is rare when validator-info is called manually but when validator-info is called by a script e.g. for monitoring purposes this happens quite often.
I was able to force this by just repeatedly starting validator-info on the cli.
Ways to solve this:
1) don't read frequently changing files but query the indy-node service and the OS
2) keep a number of input files around and if reading and parsing the latest fails go for the second oldest
3) if reading and parsing files wait a second and try again
(Intermediate solution: don't fail to provide any validator info but only fail on the info read from file but continue to provide info gathered from OS and services.)
Traceback of a modified version of validator-info so the line numbers might not match your's:
Traceback (most recent call last):
File "/usr/local/bin/validator-info2", line 830, in <module>
sys.exit(main())
File "/usr/local/bin/validator-info2", line 818, in main
print(get_stats_from_file(file_path, args.verbose, args.json, args.nagios))
File "/usr/local/bin/validator-info2", line 590, in get_stats_from_file
stats = json.loads(f.read())
File "/usr/lib/python3.5/json/_init_.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Here the file is empty and therefor not valid json.