Skip to content

High CPU load due to busy wait. #32

@stefan1000

Description

@stefan1000

FastMCP upgraded caused a busy wait, burning one core. Local fix was to disable this background task in server.py

from contextlib import asynccontextmanager
      
def __init__...

        # Disable the pydocket background-task lifespan (fastmcp 2.14+).
        # _docket_lifespan unconditionally starts a fakeredis monitor loop that
        # busy-spins one CPU core because fakeredis xread() ignores the block
        # timeout and returns immediately. p4mcp tools don't use background tasks,
        # so this context manager is pure overhead.
        @asynccontextmanager
        async def _noop_docket_lifespan():
            yield
        self.mcp._docket_lifespan = _noop_docket_lifespan

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