Skip to content

bug: json.decoder.JSONDecodeError #369

Open

Description

@junggi-hong

request_id = str(uuid.uuid4())
request_body = await request.body()
request_json = await request.json() # TODO (ApostaC): merge two awaits into one

after deploying the router server in the k8s environment, i run the stress test by locust but the error below occured at the line.
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 992 (char 991)

when i request to the vllm instance directly, it works well.
In addition, when i request to the router only once (not cocurrently), it works well too.
so i think the router is the problem.

i want to know how to receive many cocurrent requests through vllm-router like vllm independent instance.
is there any arguments or required settings for this?

my enviornment is:
nvidia H100 x 8 GPU Server
RHEL 8.8
kubenetes: v1.31.1
vllm-router 0.1.2.dev24+g168f937.d20250413
vllm: v0.7.3 / v0.8.3

Activity

  1. changed the title [-]error occured in this code[/-] [+]json.decoder.JSONDecodeError[/+] on Apr 16, 2025
  2. changed the title [-]json.decoder.JSONDecodeError[/-] [+]bug: json.decoder.JSONDecodeError[/+] on Apr 16, 2025
  3. YuhanLiu11 commented on Apr 16, 2025

    @YuhanLiu11
    Collaborator

    @junggi-hong Thanks for reporting this issue! We will try reproducing on our side. Can you share you stress test script?

  4. junggi-hong commented on Apr 17, 2025

    @junggi-hong
    Author

    @YuhanLiu11 sure!

    import random
    import json
    import logging
    from locust import FastHttpUser, task, between
    
    
    model_name = "Qwen2.5-72B-Instruct-GPTQ-Int4"
    api_key = "api_key"
    
    headers = {
            "Authorization": f"Bearer {api_key}",
            "Accept": "application/json",
        }
    
    
    import json
    with open("data.json", "r", encoding="utf-8") as f:
        data = json.load(f)
    
    
    message_list = [[
        {
            "role": "system",
            "content": """ # INSTRUCTIONS : 
        Answer the users QUESTION using the DOCUMENT text above.
        Keep your answer ground in the facts of the DOCUMENT.
            """
        },
        {
            "role": "user",
            "content": x['human'],
        },    
            ] for x in data]
    
    class LLMUser(FastHttpUser):
    
        wait_time = between(3, 5)
    
        @task
        def predict(self):
            payload = {
                "model": model_name,
                "messages": random.choice(message_list),
                "max_completion_tokens":1024,
                "temperature":0,
                "frequency_penalty":1.2,
                "presence_penalty":2
            }
    
            response = self.client.request(
                method="POST",
                url="/v1/chat/completions",
                headers=headers,
                json=payload,
            )
    
            response.raise_for_status()
            res = response.json()
            logging.info(res['choices'][0]["message"]["content"])
            logging.info(res['usage'])
    

    ** additional informations **

    the deployment yaml files are almost same but i changed the containerPort and added k8s-port arguments in deployment-router.yaml.

    each vllm instances are allocated the resources below.
    replicaCount: 1
    requestCPU: 5
    limitCPU: 10
    requestGPU: 2
    limitGPU: 4

    and the router's resource is exactly same with the values.yaml in the helm folder.
    i run the test in the local PC so sent the request from the local PC to the H100 Server.

  5. YuhanLiu11 commented on Apr 17, 2025

    @YuhanLiu11
    Collaborator

    Thank you for providing your benchmark script, we will try reproducing on our side.

  6. ruizhang0101 commented on Apr 18, 2025

    @ruizhang0101
    Collaborator

    @junggi-hong Hi, I try to reproduce it but it seems good to me, the locust return nothing wrong. According to the error, it seems like there are some json parse errors of your request. Can you check your data and the test file again or maybe curl the router with your data?

  7. junggi-hong commented on Apr 18, 2025

    @junggi-hong
    Author

    @zerofishnoodles
    thank you for the reply!

    first of all, same issue was opened for vllm.
    I run the load test to vllm instance server with same data and i also found out that when the load is high like 100 cocurrent requests, vllm instance server also return 415 error in my env too.

    however, the point is that my lmstack-router is very fragile. the router returns 415 errors when the load is very low (just 2 cocurrent requests or 2-3 sequential requests without wait time) so same error occured even without the locust load test.

    i carefully assumes that the router does not seems to deal with the request asynchronously and return 415 errors for the subsequent requests until theit receives the response from the first request.

    my data is quite long (about 5000 length) but i think it's not the memory issue...

  8. junggi-hong commented on Apr 25, 2025

    @junggi-hong
    Author

    @YuhanLiu11 @zerofishnoodles
    I found out the difference between default setting of this repo and my custom setting:
    the vllm image of this repo is lmcache/vllm-openai and image I used is vllm/vllm-openai.

    my environment is air-gapped so I have to use in-house nexus repository for pulling the container images.
    Unfortunately, lmcache/vllm-openai images are not supported yet.

    I wonder if this could be the cause of my issue.

  9. added 2 commits that reference this issue on Aug 29, 2026
    ee50929
    f162a0a
  10. added 3 commits that reference this issue on Oct 13, 2026
    613c0db
    7c6abc2
    35309ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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