Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20695 closed defect (fixed)

handle json reading exception instead of escalating

Reported by: iwakeh Owned by: iwakeh
Priority: Medium Milestone: CollecTor 1.1.1
Component: Metrics/CollecTor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

tom ritter reported this error on the metrics-list.

V, 2016-11-16 16:00:00, 7818/7819 S (100.0%), 7815/7815 E (100.0%)
V, 2016-11-16 16:00:00, 7784/7785 S (100.0%), 7781/7781 E (100.0%)
V, 2016-11-16 16:00:00, 7782/7783 S (100.0%), 7778/7779 E (100.0%)
C, 2016-11-16 16:00:00, 8/8 V (100.0%), 7127/7128 S (100.0%),
7125/7125 E (100.0%)
M, 2016-11-16 16:00:00, 7128/7128 M (100.0%)
2016-11-16 16:06:15,696 ERROR o.t.c.c.CollecTorMain:71 The relaydescs
module failed: com.google.gson.stream.MalformedJsonException: Use
JsonReader.setLenient(true) to accept malformed JSON at line 1 column
17791699
com.google.gson.JsonSyntaxException:
com.google.gson.stream.MalformedJsonException: Use
JsonReader.setLenient(true) to accept malformed JSON at line 1 column
17791699
    at com.google.gson.Gson.assertFullConsumption(Gson.java:779)
~[collector-1.1.0.jar:1.1.0-d9e32d5]
    at com.google.gson.Gson.fromJson(Gson.java:742)
~[collector-1.1.0.jar:1.1.0-d9e32d5]
    at org.torproject.collector.relaydescs.ReferenceChecker.readReferencesFile(ReferenceChecker.java:145)
~[collector-1.1.0.jar:1.1.0-d9e32d5]
    at org.torproject.collector.relaydescs.ReferenceChecker.check(ReferenceChecker.java:84)
~[collector-1.1.0.jar:1.1.0-d9e32d5]

Child Tickets

Change History (5)

comment:1 Changed 2 years ago by iwakeh

Owner: changed from metrics-team to iwakeh
Status: newaccepted

comment:2 Changed 2 years ago by iwakeh

Milestone: CollecTor 1.2.0
Status: acceptedneeds_review

Please review the two commits on top of this branch.

Reasoning:
When there is a RuntimeException it will be most likely from a parsing failure (IOE is caught separately). As CollecTor writes this file such a problem can only be due to earlier writing problems (e.g. the heap space) or manual editing or some other external change to the file. Thus, erasing it seems the best option.

The argument free constructor for Reference was necessary on order to prevent the following complaint from Gson: Unable to invoke no-args constructor for class org.torproject.collector.relaydescs.ReferenceChecker$Reference.
(I don't know why this didn't cause a problem elsewhere. I'm using the libs distributed with release 1.1.0)

Also add this to milestone 1.2.0. Shouldn't the already released milestones be closed?

comment:3 in reply to:  2 ; Changed 2 years ago by karsten

Status: needs_reviewneeds_information

Replying to iwakeh:

Please review the two commits on top of this branch.

Merged, thanks!

Reasoning:
When there is a RuntimeException it will be most likely from a parsing failure (IOE is caught separately). As CollecTor writes this file such a problem can only be due to earlier writing problems (e.g. the heap space) or manual editing or some other external change to the file. Thus, erasing it seems the best option.

Makes sense!

The argument free constructor for Reference was necessary on order to prevent the following complaint from Gson: Unable to invoke no-args constructor for class org.torproject.collector.relaydescs.ReferenceChecker$Reference.
(I don't know why this didn't cause a problem elsewhere. I'm using the libs distributed with release 1.1.0)

Hmm? I didn't look at the code here. Does this need any fixing?

Also add this to milestone 1.2.0. Shouldn't the already released milestones be closed?

There, you should now be able to create or modify milestones. Want to try closing the ones that can be closed?

comment:4 in reply to:  3 Changed 2 years ago by iwakeh

Resolution: fixed
Status: needs_informationclosed

Replying to karsten:

..

The argument free constructor for was necessary on order to prevent the following complaint from Gson: Unable to invoke no-args constructor for class org.torproject.collector.relaydescs.ReferenceChecker$Reference.
(I don't know why this didn't cause a problem elsewhere. I'm using the libs distributed with release 1.1.0)

Hmm? I didn't look at the code here. Does this need any fixing?

No, it is fixed in line 106 of ReferenceChecker. Probably showed up in the new tests for the very first time.

Also add this to milestone 1.2.0. Shouldn't the already released milestones be closed?

There, you should now be able to create or modify milestones. Want to try closing the ones that can be closed?

Thanks :-)

comment:5 Changed 2 years ago by iwakeh

Milestone: CollecTor 1.2.0CollecTor 1.1.1
Note: See TracTickets for help on using tickets.