Skip to content

[Bug] Streaming Chunk Memory Accumulation #60

@unn-Known1

Description

@unn-Known1

Summary

For very long streaming responses, collected_chunks list can grow unbounded, potentially causing memory issues.

Location

src/gateway/main.py - chat_completions() function, streaming path

Current Behavior

In the generate() function, chunks are accumulated without limit.

Expected Behavior

Implement a limit on stored chunks or use streaming token extraction without full storage.

Priority

Low

References

  • CWE-400: Resource Exhaustion

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions