mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-14 18:18:02 +00:00
Fixes #17480 Once `RemoteHandler` is connected, `whenConnected` returns a Deferred that has already fired, so `writer` runs synchronously inside `addCallbacks` and clears `_connection_waiter`. The next line then set the waiter to that fired Deferred, so every later `_connect` call returned early and logs stopped after the first line or two. This sets the waiter before adding the callbacks, so a callback that runs right away can still clear it. The new test logs a few more lines over an existing connection and checks that they all arrive. The bug came in with #9591, hence v1.30.0 in the changelog. Thanks to @haarp for tracking this down and for the detailed reproduction steps. ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))