Repository navigation
Revert "fix(s3_v2): bound concurrent S3 uploads per flush and add opt-in JSONL batch files (#41258)" on rc/1.104.0 - #43327
yucheng-berri wants to merge 1 commit into
Conversation
| for payload in self.log_queue: | ||
| asyncio.create_task(self.async_upload_data_to_s3(payload)) |
There was a problem hiding this comment.
🔴 Unbounded uploads exhaust proxy resources
A large flush makes async_send_batch start every S3 upload at once. The HTTP client has no connection limit, so a burst can exhaust connections and disrupt the proxy.
Learn more
The logger flushes accumulated events on a timer, and one event produces one S3 PUT. The removed semaphore previously capped simultaneous uploads at 16 per logger. AsyncHTTPHandler explicitly ignores its concurrent_limit argument, so it cannot bound these uploads. A slow destination allows tasks from successive flushes to overlap. Each task also obtains credentials and signs its PUT, increasing work beyond the HTTP connections alone.
Example: A proxy accumulates 512 events while S3 responds slowly. The next flush schedules 512 uploads concurrently, rather than the previous cap of 16; the following flush can schedule another 512 before those finish
Recommended fix: Bound in-flight S3 uploads across flushes, and keep an explicit lifetime for queued or running tasks so slow uploads cannot accumulate without limit
Was this helpful? React with 👍 or 👎 to provide feedback.
| s3_object_download_filename=f"{batch_name}.jsonl", | ||
| ) | ||
| for payload in self.log_queue: | ||
| asyncio.create_task(self.async_upload_data_to_s3(payload)) |
There was a problem hiding this comment.
Low: Unbounded S3 upload fan-out
Each authenticated inference request adds an entry to this queue, and the normal logging path does not enforce batch_size before the periodic flush. An attacker can therefore submit a request burst that schedules one concurrent credential lookup, signing operation, and S3 PUT per queued event; the shared HTTP handler has no application-level concurrency limit, so this can exhaust worker resources and failed uploads are discarded when the queue is cleared. Restore a semaphore or bounded worker pool, await completion, and retain failed entries for retry.
PR overviewThis PR reverts the S3 v2 changes that bounded concurrent uploads during each flush and added opt-in JSONL batch files, restoring the earlier upload behavior on the release branch. The restored S3 logging path can fan out an unbounded number of concurrent credential lookups, signing operations, and uploads when an authenticated user sends a burst of requests. This could exhaust worker resources and cause failed log uploads to be discarded, and the issue remains open with no fixes addressed yet. Open issues (1)
Fixed/addressed: 0 · PR risk: 6/10 |
|
| for payload in self.log_queue: | ||
| asyncio.create_task(self.async_upload_data_to_s3(payload)) |
There was a problem hiding this comment.
Transient upload errors lose logs
When an S3 PUT hits a connection error or timeout, the upload stops after its first attempt. This detached task cannot report the failure to flush_queue, which has already cleared the event. The S3 object is permanently missing even if the connection recovers, rather than receiving the stated three attempts.
Knowledge Base Used: Logging callbacks and telemetry
| for payload in self.log_queue: | ||
| asyncio.create_task(self.async_upload_data_to_s3(payload)) |
There was a problem hiding this comment.
Each flush now starts one upload task per event without the removed semaphore or another task limit. With sustained traffic and a slow S3 endpoint, later flushes add tasks while earlier uploads remain pending. Concurrent PUTs and worker resource use can keep growing, and operators no longer have a setting to bound them.
Knowledge Base Used: Logging callbacks and telemetry
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
Summary
Reverts #41258 (
09ebb28473) onrc/1.104.0only.mainis unchanged.#41258 changed s3_v2 so a failed upload is requeued on every flush until
max_queue_size, where earlier releases tried it 3 times and then dropped it. A live A/B against real S3 with a Deny bucket policy showed the same 10 events re-PUT about 450 times in 3.5 minutes. The follow-up fix (#43022) is still in review, so this takes #41258 out of the release candidate.Behavior changes
s3_max_concurrent_uploads,s3_batch_file_uploadandDEFAULT_S3_MAX_CONCURRENT_UPLOADSare removed. They only shipped in v1.104.0-dev.2.Testing
s3.py,s3_v2.pyandtypes/integrations/s3_v2.pyare identical to09ebb28473^.tests/test_litellm/integrations/test_s3_v2.pyandtest_s3.py: 142 passed.