Skip to content

Flaky test: DarwinEngineTest.testRequestInRunBlockingDispatchersDefault times out on CI #5475

@e5l

Description

@e5l

Root cause

The test uses withTimeout(1000) (1 second) which is too tight for CI environments under load. The test server startup + HTTP request + response reading can exceed 1 second on loaded CI agents.

Affected tests:

  • DarwinEngineTest.testRequestInRunBlockingDispatchersDefault[macosArm64]
  • DarwinLegacyEngineTest.testRequestInRunBlocking[macosArm64]

Observed behavior

Tests pass locally but fail intermittently on TeamCity macOS Arm64 agents with:

kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 1000 ms

Suggested fix

Increase the withTimeout value from 1000ms to a more generous value (e.g., 5000ms or 10000ms) to account for CI agent load variance.

Files:

  • ktor-client/ktor-client-darwin/darwin/test/DarwinEngineTest.kt
  • ktor-client/ktor-client-darwin-legacy/darwin/test/DarwinLegacyEngineTest.kt

Observed in PR #5465 and on release/3.x base branch (build 412668).

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