Skip to content

Flaky test: TestApplicationTest.testStreamingResponse race condition on mingwX64 #5476

@e5l

Description

@e5l

Root cause

The test assumes strict alternating message ordering between server-side writes and client-side reads via a Channel. This ordering is not guaranteed because the server coroutine and client coroutine may be scheduled differently on different platforms.

Error on mingwX64:

kotlin.AssertionError: Expected <Test 1>, actual <[Client] Test 1>.

Also seen on JVM on the release/3.x base branch (build 412674).

Suggested fix

The test design relies on timing-dependent interleaving. Consider using explicit synchronization (e.g., a second channel or barrier) to enforce the expected ordering, or restructure the test to not depend on strict interleaving.

File: ktor-server/ktor-server-test-host/common/test/TestApplicationTest.kt

Observed in PR #5465 and on release/3.x base branch.

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