FAForever / FAForever/server

Better logging for malformed messages

Offen
#661 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
good first issue
Vorherrschende Sprache
Python
Sterne
72
Forks
84
Ø Merge
5 Std. 11 Min.
Gemergte PRs (30 T.)
1

Beschreibung

There are a number of mysterious errors which indicate that sometimes clients are sending malformed protocol messages:

```
ERROR Sep 03 21:05:08 ServerContext Invalid control character at: line 1 column 728 (char 727)
Traceback (most recent call last):
File "/code/server/servercontext.py", line 80, in client_connected
message = await protocol.read_message()
File "/code/server/protocol/qdatastreamprotocol.py", line 119, in read_message
message = json.loads(action)
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 728 (char 727)
```

```
ERROR Sep 02 20:31:37 ServerContext Expecting ',' delimiter: line 1 column 10652 (char 10651)
Traceback (most recent call last):
File "/code/server/servercontext.py", line 80, in client_connected
message = await protocol.read_message()
File "/code/server/protocol/qdatastreamprotocol.py", line 119, in read_message
message = json.loads(action)
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 10652 (char 10651)
```

We should probably have some explicit error handling that expects these sorts of errors and logs the entire message. These could easily be caused by non FAF traffic like automated portscans or something, but if they are legitimate messages, then maybe there is a bug in the client somewhere.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.