realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.01k stars 155 forks source link

Client should handle and surface http error code 431 (headers_too_large) when sent from the server #7878

Open sync-by-unito[bot] opened 1 month ago

sync-by-unito[bot] commented 1 month ago

Related to the linked HELP ticket, this customer had a really large user object and we found that envoy was rejecting the request.

https://splunk.corp.mongodb.com/en-US/app/search/search?sid=1720636634.1258082&dispatch.sample_ratio=1&display.events.type=raw&display.page.search.mode=smart&q=search%20index%3Denvoy%20client_ip%3D%22188.24.22.213%22&earliest=1720456219.011&latest=1720456224.012

{"upstream_cluster":null,"resp_code":431,"resp_flags":"DPE","user-agent":null,"response_duration":null,"req_method":null,"x-request-id":null,"bytes_received":0,"bytes_sent":31,"upstream_host":null,"resp_code_details":"http1.headers_too_large","upstream-service-time":null,"start_time":"2024-07-08T16:30:19.642506447+0000","request_duration":null,"protocol":"HTTP/1.1","connection_termination_details":null,"response_tx_duration":null,"authority":null,"downstream_direct_remote_address":"188.24.22.213:56515","duration":51,"req_path":null,"client_ip":"188.24.22.213"}

This was not showing up in the logs in any discernable way according to the help ticket (here are the logs they posted) [^01340259 error-1.rtf]

It should be possible to repro this by using custom user data and making the object 1/2 MB (that is what the customer had it as).

The goal of this ticket would be to make sure that this is a clearer error in the logs ideally.

This was happening on this SDK release https://github.com/realm/realm-swift/releases/tag/v10.49.1 which correlates to Realm-Core 14.4.1

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RCORE-2195

sync-by-unito[bot] commented 1 month ago

➤ Jonathan Reams commented:

So, core doesn't do anything to hide this error and it's actually the SDK that implements the http client that would have to surface this error. [~diana.perez@mongodb.com], is this something the swift SDK would have to change?