Uploaded image for project: 'LLM AI Integration'
  1. LLM AI Integration
  2. LLMAI-137

LMStudio (and h2c-incompatible inference servers) produce silent pending responses due to HTTP/2 upgrade headers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.9
    • 0.8
    • None
    • Unknown

    Description

      When the AI LLM application connects to certain local inference servers (confirmed: LMStudio), requests hang indefinitely with no response and no error logged. The browser shows the request as "pending" with an empty body.

      Root Cause

      HttpClientFactory creates Java HttpClient instances with HttpClient.Version.HTTP_2. For plain HTTP connections (i.e., local inference servers using http://), Java's HttpClient sends an h2c upgrade request with the headers:

      Connection: Upgrade, HTTP2-Settings
      Upgrade: h2c
      HTTP2-Settings: ...

      Servers that correctly implement the RFC (e.g., Ollama) ignore these headers and respond with a normal HTTP/1.1 200, which Java's HttpClient accepts as a graceful fallback. However, LMStudio's HTTP server does not respond at all when it receives these headers, causing the Java HttpClient to block indefinitely. Since the hang occurs inside the StreamingOutput lambda (after the 200 SSE response headers are already sent to the browser), no exception is surfaced to the caller or logged.

        Steps to Reproduce

        1. Configure an AI server pointing to a local LMStudio instance (e.g., http://localhost:1234/v1/)

        2. Create a model bound to a LMStudio-loaded model (e.g., google/gemma-3n-e4b)

        3. Send a chat completion request with stream: true

        4. Observe: request stays "pending" indefinitely, no response, no XWiki log output

        Expected Behavior

        A response is returned from LMStudio, same as with Ollama or cloud providers.

        Actual Behavior

        The request hangs indefinitely. LMStudio never receives the request (confirmed via its activity log). No error is logged on the XWiki side.

      Attachments

        Activity

          People

            ppantiru Paul Pantiru
            ppantiru Paul Pantiru
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: