inference icon indicating copy to clipboard operation
inference copied to clipboard

Realtime runtime rejects an input frame of exactly 64 KiB

Open Jackmeson1 opened this issue 3 weeks ago • 0 comments

System Info / 系統信息

Windows 11; Python 3.14.6 and 3.10.20; aiohttp 3.14.5. Reproduced with the repository's echo runtime, without a GPU or model weights.

Running Xinference with Docker? / 是否使用 Docker 运行 Xinfernece?

Installation from source; no Docker.

Version info / 版本信息

Source revision 0b46522f6439.

The command used to start Xinference / 用以启动 xinference 的命令

The script below starts the realtime runtime on loopback. Run it from the repository root with test dependencies installed and PYTHONPATH=..

Reproduction / 复现过程

Save as repro.py and run python repro.py:

import asyncio

import aiohttp

from xinference.core.tests.test_realtime_runtime import (
    FakeModel, RealtimeRuntime, connect, wait_empty,
)


async def main():
    runtime = RealtimeRuntime(FakeModel(), "fake", "fake-0")
    await runtime.start("127.0.0.1")
    try:
        async with aiohttp.ClientSession() as client:
            for size in (65535, 65536, 65537):
                ws = await connect(client, runtime)
                await ws.receive_json(timeout=2)
                await ws.send_bytes(b"\x00" * size)
                message = await ws.receive(timeout=2)
                if message.type == aiohttp.WSMsgType.TEXT:
                    received = message.json()["data"]["received_bytes"]
                    print(f"{size}: accepted (received_bytes={received})")
                else:
                    print(f"{size}: {message.type.name} {message.data}")
                await ws.close()
                await wait_empty(runtime)
    finally:
        await runtime.stop()


asyncio.run(main())

Observed at the direct runtime:

65535: accepted (received_bytes=65535)
65536: CLOSE 1009
65537: CLOSE 1009

RealtimeRuntime passes max_frame_bytes=65536 directly to aiohttp's exclusive max_msg_size threshold. The gateway's upload check permits this size, but the runtime rejects it before the model receives it.

The close code above comes from the direct-runtime reproduction. Error delivery through the public gateway can depend on teardown scheduling and is handled separately in #6075.

Expected behavior / 期待表现

doc/source/user_guide/realtime.rst already documents 64 KiB input frames. A 65,536-byte frame should be accepted; 65,537 bytes should still be refused.

AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).

Jackmeson1 avatar Nov 11 '26 00:11 Jackmeson1