Skip to content

Revert "fix(s3_v2): bound concurrent S3 uploads per flush and add opt-in JSONL batch files (#41258)" on rc/1.104.0 - #43327

Closed
yucheng-berri wants to merge 1 commit into
rc/1.104.0from
litellm_revert_41258_rc_1_104_0
Closed

yucheng-berri wants to merge 1 commit into
rc/1.104.0from
litellm_revert_41258_rc_1_104_0

Conversation

@yucheng-berri

@yucheng-berri yucheng-berri commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reverts #41258 (09ebb28473) on rc/1.104.0 only. main is 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

Testing

  • The revert applies cleanly. s3.py, s3_v2.py and types/integrations/s3_v2.py are identical to 09ebb28473^.
  • tests/test_litellm/integrations/test_s3_v2.py and test_s3.py: 142 passed.

Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +443 to +444
for payload in self.log_queue:
asyncio.create_task(self.async_upload_data_to_s3(payload))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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

Devin Review


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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@veria-ai

veria-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

PR overview

This 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

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

[High risk] Reverts S3 upload concurrency and batch file features.

This PR does not appear safe to merge until transient upload loss and unbounded upload work are addressed, and the required surviving test coverage is restored.

Findings

  1. P1 Transient upload errors lose logs ▶
  2. P1 Uploads have no task limit ▶

Summary

Reverts S3 v2's bounded uploads, failed-upload requeue, and opt-in JSONL files on the release-candidate branch.

  • Restores detached per-request S3 uploads and removes their concurrency configuration.
  • Removes the feature's unit and integration tests, including some coverage of behavior that remains supported.

Reviews (1) · Last reviewed commit: "Revert "fix(s3_v2): bound concurrent S3 ..."

Comment on lines +443 to +444
for payload in self.log_queue:
asyncio.create_task(self.async_upload_data_to_s3(payload))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Comment on lines +443 to +444
for payload in self.log_queue:
asyncio.create_task(self.async_upload_data_to_s3(payload))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Uploads have no task limit

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

@greptile-apps

greptile-apps Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These 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.

  • P2 Failure delivery coverage removed tests/integration/observability/test_s3_v2_upload_fanout.py:241 ▶

    Deleting this test removes the end-to-end check that rejected model calls produce identifiable failure records in S3. The remaining unit test uploads a constructed event directly, so it does not cover delivery through the proxy. The repository requires test changes not to weaken regression coverage; retain a test for this surviving behavior before merging.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

1 participant