Skip to content

HTTP send() hangs on large request bodies (11MB+) #36

@g3blv

Description

@g3blv

Description

When using waki HTTP client to upload large files from a WASM module, the send() method hangs indefinitely, no error messages or panics - the program just hangs for files over ~11MB. Smaller files (0.18 MB) upload successfully using the exact same code.

Environment

  • waki version: 0.5.0
  • Runtime: Wasmtime 34.0.0 with WASI HTTP support
  • Use case: Google Cloud resumable file upload API

Expected Behavior

The send() method should complete and return a response for requests with large bodies, similar to this curl command:

curl "${upload_url}" \
  -H "Content-Length: ${NUM_BYTES}" \
  -H "X-Goog-Upload-Offset: 0" \
  -H "X-Goog-Upload-Command: upload, finalize" \
  --data-binary "@${AUDIO_PATH}"

Actual Behavior

  • 0.18 MB file: send() completes successfully
  • 11.08 MB file: send() hangs indefinitely, no error returned

Code to Reproduce

use waki::Client;

let file_bytes = fs::read(audio_path)?;  
println!("File loaded: {} bytes", file_bytes.len());

let client = Client::new();
let upload_request = client
    .post(&upload_url)
    .header("Content-Length", &file_size.to_string())
    .header("X-Goog-Upload-Offset", "0")
    .header("X-Goog-Upload-Command", "upload, finalize")
    .body(file_bytes);  // Vec<u8> with 11.08 MB
    
println!("Calling send()...");
let upload_response = upload_request.send()?;  // <-- HANGS HERE
println!("Response received");  // Never reached for large file

Debugging Help Needed

  1. Is there a way to enable verbose/debug logging in waki to see what's happening inside send()?

    • Where exactly in the send process is it hanging?
    • Is the data being transmitted at all?
    • Is it waiting for a response that never comes?
  2. Are there internal buffer size limitations in waki?

    • Does waki have a maximum request body size?
    • Is there a difference in how small vs large bodies are handled internally?
  3. Can I inspect the underlying HTTP connection?

    • Is there a way to see if bytes are being transmitted?
    • Can I get progress callbacks during the upload?

Questions

  1. What's the recommended approach for uploading large files with waki?
  2. Are there any environment variables or configuration options that might help debug this?
  3. Is there a maximum recommended request body size?

I'm happy to provide additional debugging information, test patches, or try alternative approaches. Thank you for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions