crossbario / crossbario/autobahn-python
HTTP headers causing exception in debug
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
KeyError exception experienced using asyncio, with txaio logging level at debug, when performing WAMP handshake.
A debug logging statement in asyncio.websocket.protocol.WebSocketServerProtocol.processHandshake receives the HTTP header dict cast to a string. This seems to be read as part of the formatting, causing a KeyError to be raised from the logger during interpolation, as the tokens visible between the braces are not present in kwargs.
Example output:
2016-03-01T15:17:02 Exception in callback WebSocketAdapterProtocol._consume.<locals>.process(<Future finished result=None>) at /usr/local/lib/python3.4/dist-packages/autobahn/asyncio/websocket.py:105
I tried to see where this had come in, but it seems to happen in master, and is not obvious following git blame back (at least to me!) - can bisect if desired. Also, not sure whether the preferred solution is to have the braces escaped or a dict passed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at autobahn/websocket/protocol.py, in asyncio.websocket.protocol.WebSocketServerProtocol.processHandshake around line 3484, and inspect the debug logging statement that formats the HTTP header dictionary. Reproduce a WAMP handshake with txaio logging at debug level. Done means the handshake no longer raises KeyError while interpolating the logged headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100