Skip to content
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

[BUG] POST always (sometimes) times out when using .body(()) #447

Open
Vernoxvernax opened this issue May 8, 2024 · 3 comments
Open

[BUG] POST always (sometimes) times out when using .body(()) #447

Vernoxvernax opened this issue May 8, 2024 · 3 comments

Comments

@Vernoxvernax
Copy link

Vernoxvernax commented May 8, 2024

isahc = { version = "1.7.2", features = [ "json" ] }
rustc 1.78.0 (9b00956e5 2024-04-29)
curl 8.7.1 (x86_64-pc-linux-gnu) libcurl/8.7.1 OpenSSL/3.3.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.61.0 nghttp3/1.2.0

Sorry, if im mistaken, but it seems that something somewhere changed, so that it's no longer possible to send POST requests with an empty body. They will just time out. I went through the last few commits, but they don't seem to change the versions of the dependencies.
Yeah, I know that was all really vague, but here is the kicker: The problem occurs only on some of my pcs. Even though the curl/rust-toolchain versions match. My guess is, that it's a link to some c library or something. As you can tell my knowledge already ended when I clicked New issue, so I'll just leave you these two logs:

Working here:

[2024-05-08T18:46:20Z DEBUG isahc::client] send; method=POST uri=https://rest-e420.immedia-semi.com/api/v1/accounts/123456/networks/123456/sync_modules/123456/local_storage/manifest/request
[2024-05-08T18:46:20Z DEBUG isahc::handler] handler;
[2024-05-08T18:46:20Z DEBUG isahc::handler] handler; id=0
[2024-05-08T18:46:20Z DEBUG isahc::handler] Found bundle for host: 0x77bdfc00f7a0 [can multiplex]
[2024-05-08T18:46:20Z DEBUG isahc::handler] Re-using existing connection #1 with host rest-e420.immedia-semi.com
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [:method: POST]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [:path: /api/v1/accounts/123456/networks/123456/sync_modules/123456/local_storage/manifest/request]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [:scheme: https]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [:authority: rest-e420.immedia-semi.com]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [accept: */*]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [accept-encoding: deflate, gzip]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [token-auth: >:3]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [user-agent: Blink/123456789 CFNetwork/ssss.1 Darwin/haha]
[2024-05-08T18:46:20Z DEBUG isahc::handler] h2h3 [content-type: application/json]
[2024-05-08T18:46:20Z DEBUG isahc::handler] Using Stream ID: 5 (easy handle 0x632510aba090)
[2024-05-08T18:46:20Z DEBUG isahc::handler] Connection #1 to host rest-e420.immedia-semi.com left intact

Not working here:

[2024-05-08T19:26:42Z DEBUG isahc::client] send; method=POST uri=https://rest-e420.immedia-semi.com/api/v1/accounts/123456/networks/123456/sync_modules/123456/local_storage/manifest/request
[2024-05-08T19:26:42Z DEBUG isahc::handler] handler;
[2024-05-08T19:26:42Z DEBUG isahc::handler] handler; id=0
[2024-05-08T19:26:42Z DEBUG isahc::handler] Found bundle for host: 0x7f390800f4c0 [can multiplex]
[2024-05-08T19:26:42Z DEBUG isahc::handler] Re-using existing connection with host rest-e420.immedia-semi.com
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] OPENED stream for https://rest-e420.immedia-semi.com/api/v1/accounts/123456/networks/123456/sync_modules/123456/local_storage/manifest/request
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [:method: POST]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [:scheme: https]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [:authority: rest-e420.immedia-semi.com]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [:path: /api/v1/accounts/123456/networks/123456/sync_modules/123456/local_storage/manifest/request]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [accept: */*]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [accept-encoding: deflate, gzip]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [token-auth: :3]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [user-agent: Blink/123456789 CFNetwork/ssss.1 Darwin/haha]
[2024-05-08T19:26:42Z DEBUG isahc::handler] [HTTP/2] [3] [content-type: application/json]
[2024-05-08T19:27:02Z DEBUG isahc::handler] Operation timed out after 19999 milliseconds with 0 bytes received
[2024-05-08T19:27:02Z DEBUG isahc::handler] Connection #1 to host rest-e420.immedia-semi.com left intact
[2024-05-08T19:27:02Z WARN  isahc::handler] request completed with error: request or operation took longer than the configured timeout time

The Code (simplified):

  let mut builder = Request::post(url)
    .header(header.key, header.value)
    .header("User-Agent", USER_AGENT)
    .header("content-type", "application/json")
  .timeout(Duration::from_secs(20));

  builder.body(()).unwrap().send();

The Fix:

builder.body(String::new()).unwrap().send();
@sagebind
Copy link
Owner

sagebind commented Jun 1, 2024

One clear difference is it seems like different versions of libcurl is being used under the hood on the different machines. Would it be possible to capture the output of isahc::version() on each machine separately for comparison?

@Vernoxvernax
Copy link
Author

One clear difference is it seems like different versions of libcurl is being used under the hood on the different machines. Would it be possible to capture the output of isahc::version() on each machine separately for comparison?

Working with:

isahc/1.7.2 (features:default,encoding-rs,http2,json,mime,serde,serde-json,static-curl,text-decoding) libcurl/8.0.1-DEV OpenSSL/3.3.0 zlib/1.3.1 nghttp2/1.45.0

Not working with:

isahc/1.7.2 (features:default,encoding-rs,http2,json,mime,serde,serde-json,static-curl,text-decoding) libcurl/8.6.0-DEV OpenSSL/3.3.0 zlib/1.3.1 nghttp2/1.61.0

Then, I ran cargo update on both machines, now the system that was working before, does not work anymore and also shows:

isahc/1.7.2 (features:default,encoding-rs,http2,json,mime,serde,serde-json,static-curl,text-decoding) libcurl/8.6.0-DEV OpenSSL/3.3.0 zlib/1.3.1 nghttp2/1.61.0

@Vernoxvernax
Copy link
Author

Vernoxvernax commented Jun 25, 2024

@sagebind
I was able to observe the same issue in the latest debian bookwork-slim docker image link.
Additionally I ran apt install libssl-dev curl.
Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants