Skip to content

Mock server tests use _received_count which is vulnerable to TCP segment splitting #111

@SeanTAllen

Description

@SeanTAllen

Mock server tests (in _test_session.pony, _test_cancel.pony, _test_auth.pony, _test_copy_in.pony, etc.) use _received_count — counting _on_received calls — to determine which protocol phase the server is in. But _on_received fires per TCP segment, not per protocol message. If TCP splits a small message across two segments, the count gets out of sync and the server responds incorrectly.

Observed: CopyIn/Abort failed intermittently with "Expected ErrorResponseMessage but got ClientQueryError" — the mock server likely processed a split segment as a phase transition, causing the client session to shut down.

The fix would be to buffer all data and track protocol state by parsing message boundaries (type byte + length) instead of counting _on_received calls. This affects all mock server tests that use the _received_count pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions