element-hq / element-hq/synapse

Thumbnail rendering can throw an error while it's outputting and cause a traceback

Open
#3,813 0 comments 0 reactions 0 assignees View on GitHub
A-Logging A-Media-Repository T-Defect z-p3
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#3813](https://github.com/matrix-org/synapse/issues/3813).

---

```
2018-09-06 18:27:29,177 - synapse.http.site - 144 - ERROR - GET-3175501- Asynchronous messge handler raised an uncaught exception
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/synapse/http/site.py", line 141, in processing
yield
File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 190, in wrapped_async_request_handler
yield h(self, request)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 111, in wrapped_request_handler
pretty_print=_request_user_agent_is_curl(request),
File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 409, in respond_with_json
response_code_message=response_code_message,
File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 439, in respond_with_json_bytes
producer.start()
File "/usr/lib/python2.7/dist-packages/twisted/web/static.py", line 735, in start
self.request.registerProducer(self, False)
File "/usr/lib/python2.7/dist-packages/twisted/web/http.py", line 927, in registerProducer
"unregistered" % (producer, self.producer))
ValueError: registering producer before previous one () was unregistered
```

Contributor guide

Open the contributing guide

Research direction

Start by reading synapse/http/server.py around respond_with_json and respond_with_json_bytes, then follow the thumbnail request path into Twisted's producer handling shown in the traceback. Reproduce the rendering request if possible and determine the lifecycle condition that permits a second producer registration; done means the request completes without this traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.