Average bandwidth module complaining about invalid line
I have noticed the average bandwidth stats module is not completing cleanly on metrics.tpo update.
2022-10-20 00:08:42,342 WARN o.t.m.s.main.Main:76 Caught an exception when invoking the main method of the org.torproject.metrics.stats.advbwdist.Main module. Moving on to the next module, if available.
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.torproject.metrics.stats.main.Main.main(Main.java:72)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 10, length 4
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at org.torproject.metrics.stats.advbwdist.Main.main(Main.java:158)
... 5 common frames omitted
I have found out in the code that the date line is not formatted as it should somehow.
I have also found that the file /srv/metrics.torproject.org/metrics/work/modules/advbwdist/stats/advbwdist-validafter.csv
and an invalid date in one of the recent lines. I have deleted that
For the future since it is difficult to understand why this is happening we should allow the exception to be logged so we can see the culprit line right away and then take the necessary steps to parse it properly.
Edited by Hiro