Skip to content

fix(cloud): set timeouts on document uploads - #716

Closed
DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/cloud-upload-timeout
Closed

DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/cloud-upload-timeout

Conversation

@DivyamTalwar

Copy link
Copy Markdown

Closes #649.

Summary

A synchronous cloud PDF upload can stay blocked when the server has received the file but stalls before sending a response. Set a 30-second connection timeout and a 600-second read timeout. Callers can override both with the cloud-only submit_document(upload_timeout=(connect_seconds, read_seconds)) option.

The timeouts apply to the upload transport. Processing-status polling starts after a successful upload. A read timeout propagates to the caller without resending a POST whose outcome may be unknown.

Thanks to Ziyang Guo for the finite timeout proposal in #679. This keeps the 600-second read budget from that PR and adds a separate connection budget and caller override.

Validation

  • The focused SDK pytest selection passed all three tests covering the default, a real slow-response HTTP server, and local-mode option validation.
  • In an additional loopback comparison, main was still waiting 0.7 seconds after the server received the upload. With a 0.1-second read timeout, the patch raised requests.exceptions.ReadTimeout after about 0.103 seconds and the server recorded exactly one POST, even with wait=True.
  • git diff --check.

@rejojer

rejojer commented Dec 1, 2026

Copy link
Copy Markdown
Member

Thanks @DivyamTalwar for finding this and for the clear test. #733 fixes it and is now on main; it ships in the next release, so I'm closing this one.

We used (None, 600) instead of (30, 600). requests sends the multipart body in one write, so the connect timeout caps sending the whole file, not each block. With 30 s, a 50 MB scan on a 10 Mbit/s line (about 40 s to send) would fail. #733 keeps the send unlimited and waits at most 600 s for the answer once the file is sent. It covers Page Classify and Page Split uploads too.

@rejojer rejojer closed this Dec 1, 2026
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

Successfully merging this pull request may close these issues.

Cloud submit_document sends uploads without a connect/read timeout

3 participants