-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow/hanging HTTP responses from self-hosted Synapse homeserver. #3894
Comments
It's the sending of the request that's timing out, maybe the server takes too long to respond. You could try using a different (For support, you might have a better chance using the Matrix room for quicker feedback.) |
Ah, I didn't know there was a Matrix room for this project. Thanks! I'll close this and continue in the Room. |
Actually, I'll reopen this issue, because I think something low-level in the HTTP client is going wrong. |
Essentially, with Below are the last few lines at a 'hang point': 2024-08-26T17:09:48.772487Z DEBUG sync_once{sync_settings=SyncSettings { timeout: 900s, full_state: false, set_presence: "online" }}:keys_query{request_id="9e2908872d1349c7956cfbb8dd7bd434" device_keys={"@shymega:mtx.shymega.org.uk": []}}: eyeball::state: No wakers
2024-08-26T17:09:48.772839Z TRACE sync_once{sync_settings=SyncSettings { timeout: 900s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 930s } request_id="REQ-8"}: matrix_sdk::http_client: Serializing request request_type="ruma_client_api::sync::sync_events::v3::Request"
2024-08-26T17:09:48.772986Z DEBUG sync_once{sync_settings=SyncSettings { timeout: 900s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 930s } request_id="REQ-8" method=GET uri="https://mtx.shymega.org.uk/_matrix/client/v3/sync"}: matrix_sdk::http_client::native: Sending request num_attempt=1
2024-08-26T17:09:48.773152Z TRACE sync_once{sync_settings=SyncSettings { timeout: 900s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 930s } request_id="REQ-8" method=GET uri="https://mtx.shymega.org.uk/_matrix/client/v3/sync"}: hyper_util::client::legacy::pool: take? ("https", mtx.shymega.org.uk): expiration = Some(90s)
2024-08-26T17:09:48.773180Z DEBUG sync_once{sync_settings=SyncSettings { timeout: 900s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 930s } request_id="REQ-8" method=GET uri="https://mtx.shymega.org.uk/_matrix/client/v3/sync"}: hyper_util::client::legacy::pool: reuse idle connection for ("https", mtx.shymega.org.uk) |
I should also mention I have Matrix behind Cloudflare. It's proxied, and doesn't generally cause issues. |
sync_once
It takes 930s before hitting the timeout, that's quite a lot (15mn). From the server logs, do you see a request coming? |
I can't help you more with the information I've. Check if the server receives the request or takes a while to compute the request (it can happen with sync v3 for super large accounts). If you have a proxy, did you configure the |
The server is behind a Cloudflare Argo Tunnel, over HTTPS. Cloudflare Argo connects to the localhost HTTP (port: 8008) server Synapse exposes. I am not using a proxy. Yes, I reach the timeout if I use the default timeout int. That's why I boosted it, but it still hangs. |
Does another client hang? |
No, that's the strange thing. The JS SDK works, as does the Element app. |
Please try to debug from the server-side: do you receive a request? does the server send a response? |
The server seems to receive the sync request. As to sending responses, this I doubt. The SDK spits this out: 2024-08-27T09:28:52.479853Z TRACE sync_once{sync_settings=SyncSettings { timeout: 30s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 60s } request_id="REQ-2" method=GET uri="https://mtx.shymega.org.uk/_matrix/client/v3/sync"}: hyper_util::client::legacy::client: http1 handshake complete, spawning background dispatcher task
2024-08-27T09:28:52.480110Z TRACE sync_once{sync_settings=SyncSettings { timeout: 30s, full_state: false, set_presence: "online" }}:send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 60s } request_id="REQ-2" method=GET uri="https://mtx.shymega.org.uk/_matrix/client/v3/sync"}: hyper_util::client::legacy::pool: checkout dropped for ("https", mtx.shymega.org.uk) The thing that jumps out at me is the line that says:
|
There is also one other recurring line that makes me think it's something to do with HTTP/2:
|
I've been trying with varying timeouts, with no luck so far. Reqwest simply hangs mid-connection. This is bizarre. |
If you try without the Cloudflare proxy, or with the proxy but with HTTP1, does it work? The Cloudflare proxy may tweak the HTTP headers/values in subtle ways, so at the extreme, it might be a bug on their side… |
There's a bit more activity when I disable the proxy. Sync is still stuck, but the logs from the SDK seem more 'busy' - as well as Synapse. |
Actually, re-read the logs - it's just fetching |
Below are logs from the SDK. It just does this in a loop now. It might point to my 2024-08-27T15:06:59.676881Z TRACE build{homeserver=ServerName { server: "mtx.shymega.org.uk", protocol: Https }}:send{server_versions=[V1_0] config=RequestConfig { timeout: 30s, retry_limit: 3 } request_id="REQ-0" method=GET uri="https://mtx.shymega.org.uk/.well-known/matrix/client" status=200 response_size="180 B"}:Connection{peer=Client}:poll: h2::proto::streams::prioritize: writing frame=Headers { stream_id: StreamId(9), flags: (0x5: END_HEADERS | END_STREAM) }
2024-08-27T15:06:59.676897Z DEBUG build{homeserver=ServerName { server: "mtx.shymega.org.uk", protocol: Https }}:send{server_versions=[V1_0] config=RequestConfig { timeout: 30s, retry_limit: 3 } request_id="REQ-0" method=GET uri="https://mtx.shymega.org.uk/.well-known/matrix/client" status=200 response_size="180 B"}:Connection{peer=Client}:poll:FramedWrite::buffer{frame=Headers { stream_id: StreamId(9), flags: (0x5: END_HEADERS | END_STREAM) }}: h2::codec::framed_write: send frame=Headers { stream_id: StreamId(9), flags: (0x5: END_HEADERS | END_STREAM) }
2024-08-27T15:06:59.676953Z TRACE build{homeserver=ServerName { server: "mtx.shymega.org.uk", protocol: Https }}:send{server_versions=[V1_0] config=RequestConfig { timeout: 30s, retry_limit: 3 } request_id="REQ-0" method=GET uri="https://mtx.shymega.org.uk/.well-known/matrix/client" status=200 response_size="180 B"}:Connection{peer=Client}:poll: h2::proto::streams::prioritize: schedule_pending_open
2024-08-27T15:06:59.676970Z TRACE build{homeserver=ServerName { server: "mtx.shymega.org.uk", protocol: Https }}:send{server_versions=[V1_0] config=RequestConfig { timeout: 30s, retry_limit: 3 } request_id="REQ-0" method=GET uri="https://mtx.shymega.org.uk/.well-known/matrix/client" status=200 response_size="180 B"}:Connection{peer=Client}:poll:FramedWrite::flush: h2::codec::framed_write: queued_data_frame=false
2024-08-27T15:06:59.677092Z TRACE build{homeserver=ServerName { server: "mtx.shymega.org.uk", protocol: Https }}:send{server_versions=[V1_0] config=RequestConfig { timeout: 30s, retry_limit: 3 } request_id="REQ-0" method=GET uri="https://mtx.shymega.org.uk/.well-known/matrix/client" status=200 response_size="180 B"}:Connection{peer=Client}:poll:FramedWrite::flush: h2::codec::framed_write: flushing buffer |
I think this is my end. The SDK works fine with Element One. I've gone back to my thread in the Synapse room - unless there's a better place? If the team deem it appropriate, I'm happy for this ticket to be closed. |
Sounds good. Curious what's causing it. Good luck! |
Just a quick update: I found a legacy |
No luck yet. @bnjbvr Just a quick question - is the SDK meant able to respect the |
It's clearer since #3889, which landed yesterday, which allows you to specify a |
We don't provide personal unpaid support for using the SDK; feel free to ask in the Matrix dev room I pointed to previously, though. |
No worries, I understand. It was a big ask. I'll ask in there now. |
Once I figure it out, I've made a note to submit a PR with an example. |
I'm writing a small utility to leave rooms on my Matrix account using the Rust SDK. However, it consistently times out, despite editing
SyncSettings
, or using a machine closer to my self-hosted Synapse server.I've also made the utility public: https://github.com/shymega/matrix-leave.
I can see activity in the logs, but it's like the SDK is being impatient.
Logs:
Can someone help? Thanks!
The text was updated successfully, but these errors were encountered: