Skip to content

[Bugfix] fix request_id of image generation in api server#1112

Merged
hsliuustc0106 merged 4 commits intovllm-project:mainfrom
ZJY0516:apiserver-fix
Jan 30, 2026
Merged

[Bugfix] fix request_id of image generation in api server#1112
hsliuustc0106 merged 4 commits intovllm-project:mainfrom
ZJY0516:apiserver-fix

Conversation

@ZJY0516
Copy link
Collaborator

@ZJY0516 ZJY0516 commented Jan 30, 2026

Purpose

FIX #1080, using time as request_id can not handle concurrent requests.

Test Plan

import time
import threading
import requests
import traceback

URL = "http://localhost:8000/v1/images/generations"

PAYLOAD = {
    "prompt": "可爱的卡通橘猫,白色背景",
    "n": 1,
    "size": "512x512",
    "response_format": "b64_json",
    "num_inference_steps": 8,
}

CONCURRENCY = 4        # 改成 3 / 4 也能复现
TIMEOUT = 60           # 秒

barrier = threading.Barrier(CONCURRENCY)

def run(i):
    try:
        print(f"[req {i}] ready")
        barrier.wait()   # 👉 保证同时发请求

        start = time.time()
        resp = requests.post(URL, json=PAYLOAD, timeout=TIMEOUT)
        cost = time.time() - start

        print(
            f"[req {i}] DONE status={resp.status_code} "
            f"cost={cost:.2f}s "
            f"resp_len={len(resp.content)}"
        )

    except Exception as e:
        cost = time.time() - start
        print(
            f"[req {i}] ERROR cost={cost:.2f}s "
            f"type={type(e).__name__} "
            f"err={e}"
        )
        traceback.print_exc()


def main():
    threads = []
    for i in range(CONCURRENCY):
        t = threading.Thread(target=run, args=(i,))
        t.start()
        threads.append(t)

    for t in threads:
        t.join()

    print("=== all threads joined ===")


if __name__ == "__main__":
    main()

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

Signed-off-by: zjy0516 <[email protected]>
@ZJY0516 ZJY0516 added this to the v0.14.0 milestone Jan 30, 2026
Signed-off-by: zjy0516 <[email protected]>
@ZJY0516 ZJY0516 requested a review from david6666666 January 30, 2026 14:18
Signed-off-by: zjy0516 <[email protected]>
@ZJY0516 ZJY0516 mentioned this pull request Jan 30, 2026
5 tasks
@hsliuustc0106 hsliuustc0106 added the ready label to trigger buildkite CI label Jan 30, 2026
@hsliuustc0106 hsliuustc0106 merged commit 8ad3957 into vllm-project:main Jan 30, 2026
6 of 7 checks passed
@tjtanaa tjtanaa mentioned this pull request Jan 31, 2026
5 tasks
dongbo910220 pushed a commit to dongbo910220/vllm-omni that referenced this pull request Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready label to trigger buildkite CI

Projects

None yet

2 participants