Skip to content

[Server] Parallel requests on one session overwrite each other's session writes #58

Description

@chr-hertel

Residual of modelcontextprotocol#275 that modelcontextprotocol#535 left open: Session loads the whole blob once and save() writes it back, so concurrent requests on one session lose updates.

  • tool handlers: 10 parallel incr() calls writing $context->getSession() lose 25-36 of 50 increments
  • SDK bookkeeping is affected the same way - request id counter, pending requests, responses, subscriptions
  • logging/setLevel sent while other calls run on the session is lost again in some sessions (php -S: 7/8)

Every runtime, main and v0.8.1.

cd harness && uv run gauntlet run -t fpm,worker -s concurrency.session-counter,concurrency.log-level-sticks

Options: the opt-in per-session lock discussed in modelcontextprotocol#275, and/or moving SDK bookkeeping out of the shared blob into per-key storage.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions