source: trunk/misc/incident-gatherer/classify_tahoe.py

Last change on this file was f3d73042, checked in by Brian Warner <warner@…>, at 2008-10-15T22:09:40Z

misc/incident-gatherer: add classify_tahoe.py: a foolscap incident-gatherer classification plugin

  • Property mode set to 100644
File size: 2.4 KB
Line 
1
2import re
3
4umidmap = {
5    'lp1vaQ': 'download-not-enough-shares',
6    '3uuBUQ': 'download-connection-lost-in-get-buckets',
7    'LkD9Pw': 'user-incident-button',
8}
9
10def classify_incident(trigger):
11    m = trigger.get('message', '')
12    f = trigger.get('format', '')
13
14    umid_value = umidmap.get(trigger.get('umid',''), None)
15    if umid_value:
16        return umid_value
17
18    if re.search(r"^they had shares .* that we didn't know about$", m):
19        # Publish._got_write_answer
20        return "mutable-publish-surprise-shares"
21
22    if m.startswith("error during query"):
23        # there are a couple of different places that can generate this
24        # message (the result of cut-and-paste error-handling), so it isn't
25        # clear which is which
26
27        if re.search(r'mutable/servermap\.py.*_do_query', m):
28            # servermap.ServermapUpdater._query_failed()
29            where = "mapupdate"
30        elif re.search(r'mutable/retrieve\.py.*_got_results_one_share', m):
31            where = "retrieve"
32        else:
33            where = "unknown"
34
35        if ("Calling Stale Broker" in m and "DeadReferenceError" in m):
36            # a storage server went offline while we were talking to it (or
37            # because the client was shut off in the middle of an operation)
38            what = "lost-server"
39        elif "IOError" in m:
40            what = "ioerror"
41        elif ("UncoordinatedWriteError" in m and
42              "someone wrote to the data since we read the servermap" in m):
43            what = "uncoordinated-write-error"
44        elif "ConnectionLost" in m:
45            what = "lost-server"
46        else:
47            what = "unknown"
48
49        return "mutable-" + where + "-query-" + what
50
51    if (f.startswith("ran out of peers:") and
52        "have" in trigger and "need" in trigger):
53        return "mutable-retrieve-failure"
54    if m.startswith("invalid privkey from "):
55        # TODO: a UCW causes this, after the prefix has changed. Compare the
56        # prefix before trying to validate the privkey, to avoid the
57        # duplicate error.
58        return "mutable-mapupdate-bad-privkey"
59
60    if trigger.get('facility', '') == "tahoe.introducer":
61        if (trigger.get('isError', False)
62            and "ConnectionDone" in str(trigger.get('failure',''))):
63            return "introducer-lost-connection"
64        if "Initial Introducer connection failed" in m:
65            return "introducer-connection-failed"
66
67    return None
Note: See TracBrowser for help on using the repository browser.