Merge pull request #2762 from derekpierre/no-bytes

Don't put bytes directly into log - instead write as hex
pull/2766/head
Derek Pierre 2021-07-26 12:16:34 -04:00 committed by GitHub
commit 1ae99e1350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1 @@
Stop writing bytes to log file which causes exceptions - instead write the hex representation.

View File

@ -822,7 +822,7 @@ class Learner:
# TODO: Bucket separately and report.
unresponsive_nodes.add(current_teacher) # This does nothing.
self.known_nodes.mark_as(current_teacher.InvalidNode, current_teacher)
self.log.warn(f"Teacher {str(current_teacher)} is invalid: {bytes(current_teacher)}:{e}.")
self.log.warn(f"Teacher {str(current_teacher)} is invalid (hex={bytes(current_teacher).hex()}):{e}.")
self.suspicious_activities_witnessed['vladimirs'].append(current_teacher)
return
except RuntimeError as e:
@ -832,11 +832,13 @@ class Learner:
return RELAX
else:
self.log.warn(
f"Unhandled error while learning from {str(current_teacher)}: {bytes(current_teacher)}:{e}.")
f"Unhandled error while learning from {str(current_teacher)} "
f"(hex={bytes(current_teacher).hex()}):{e}.")
raise
except Exception as e:
self.log.warn(
f"Unhandled error while learning from {str(current_teacher)}: {bytes(current_teacher)}:{e}.") # To track down 2345 / 1698
f"Unhandled error while learning from {str(current_teacher)} "
f"(hex={bytes(current_teacher).hex()}):{e}.") # To track down 2345 / 1698
raise
finally:
# Is cycling happening in the right order?