Skip to content

Try to fix flake in Kafa DSM tests#7209

Closed
andrewlock wants to merge 1 commit into
masterfrom
andrew/ci/kafka-crash
Closed

Try to fix flake in Kafa DSM tests#7209
andrewlock wants to merge 1 commit into
masterfrom
andrew/ci/kafka-crash

Conversation

@andrewlock

Copy link
Copy Markdown
Member

Summary of changes

Add unique suffix to data streams topics in kafka tests

Reason for change

Saw some flake in a test recently: 10:19:53 [DBG] Unhandled exception. Confluent.Kafka.ProduceException2[System.String,System.String]: Local: Unknown topic`

What's more, the creation logs are kind of strange.

10:19:53 [DBG]  Creating topics...
10:19:53 [DBG]  Trying to delete topic data-streams-1...
10:19:53 [DBG]  Trying to create topic data-streams-1...
10:19:53 [DBG]  Topic already exists
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Topic did not exist, skipping
10:19:53 [DBG]  Trying to create topic data-streams-2...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Trying to delete topic data-streams-3...
10:19:53 [DBG]  Trying to create topic data-streams-3...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Finished creating topics: 0:00:02.1158037

I can't really understand that sequence of logs, but deletes don't happen atomically, so not entirely surprised by weirdness. Rather than have to deal with it explicitly, add a random suffix to the topics so that we don't have to worry about the delete case.

Implementation details

Add a random suffix to topic names, so that we should always be starting with fresh topics

Test coverage

This is the test

Other details

@andrewlock
andrewlock requested a review from a team as a code owner July 11, 2025 12:59
@andrewlock andrewlock added the area:tests unit tests, integration tests label Jul 11, 2025
@andrewlock
andrewlock requested a review from a team as a code owner July 11, 2025 12:59
@dd-trace-dotnet-ci-bot

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (73ms)  : 71, 74
     .   : milestone, 73,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7209) - mean (69ms)  : 67, 71
     .   : milestone, 69,
    master - mean (69ms)  : 65, 73
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (1,023ms)  : 999, 1047
     .   : milestone, 1023,
    master - mean (1,023ms)  : 1000, 1045
     .   : milestone, 1023,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (105ms)  : 103, 106
     .   : milestone, 105,
    master - mean (105ms)  : 104, 106
     .   : milestone, 105,

    section Baseline
    This PR (7209) - mean (104ms)  : 102, 106
     .   : milestone, 104,
    master - mean (104ms)  : 101, 107
     .   : milestone, 104,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (700ms)  : 680, 719
     .   : milestone, 700,
    master - mean (705ms)  : 688, 721
     .   : milestone, 705,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (93ms)  : 92, 94
     .   : milestone, 93,
    master - mean (93ms)  : 91, 94
     .   : milestone, 93,

    section Baseline
    This PR (7209) - mean (92ms)  : 90, 94
     .   : milestone, 92,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (661ms)  : 641, 682
     .   : milestone, 661,
    master - mean (666ms)  : 643, 690
     .   : milestone, 666,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (197ms)  : 192, 202
     .   : milestone, 197,
    master - mean (196ms)  : 191, 200
     .   : milestone, 196,

    section Baseline
    This PR (7209) - mean (193ms)  : 187, 200
     .   : milestone, 193,
    master - mean (192ms)  : 185, 198
     .   : milestone, 192,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (1,140ms)  : 1118, 1161
     .   : milestone, 1140,
    master - mean (1,126ms)  : 1103, 1149
     .   : milestone, 1126,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (276ms)  : 270, 281
     .   : milestone, 276,
    master - mean (272ms)  : 266, 279
     .   : milestone, 272,

    section Baseline
    This PR (7209) - mean (276ms)  : 270, 283
     .   : milestone, 276,
    master - mean (270ms)  : 262, 278
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (902ms)  : 878, 926
     .   : milestone, 902,
    master - mean (897ms)  : 870, 924
     .   : milestone, 897,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (269ms)  : 263, 276
     .   : milestone, 269,
    master - mean (264ms)  : 258, 271
     .   : milestone, 264,

    section Baseline
    This PR (7209) - mean (270ms)  : 264, 277
     .   : milestone, 270,
    master - mean (266ms)  : 261, 272
     .   : milestone, 266,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (895ms)  : 864, 926
     .   : milestone, 895,
    master - mean (885ms)  : 857, 913
     .   : milestone, 885,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7209) - mean (268ms)  : 263, 273
     .   : milestone, 268,
    master - mean (267ms)  : 260, 275
     .   : milestone, 267,

    section Baseline
    This PR (7209) - mean (268ms)  : 263, 274
     .   : milestone, 268,
    master - mean (267ms)  : 258, 276
     .   : milestone, 267,

    section CallTarget+Inlining+NGEN
    This PR (7209) - mean (805ms)  : 782, 827
     .   : milestone, 805,
    master - mean (798ms)  : 773, 822
     .   : milestone, 798,

Loading

@andrewlock

Copy link
Copy Markdown
Member Author

Superseded by #7211

@andrewlock andrewlock closed this Jul 11, 2025
andrewlock added a commit that referenced this pull request Jul 14, 2025
## Summary of changes

Fixes flake in DSM tests by using unique but stable topic names

> Supersedes #7209

## Reason for change

[Saw some flake in a test
recently](https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=181163&view=logs&j=b7fc299e-b4c1-5ec0-1e5a-2167c3cc6270&t=2406fbf1-c048-53d0-bb5f-56f6b7adbd43):
`10:19:53 [DBG] Unhandled exception.
Confluent.Kafka.ProduceException`2[System.String,System.String]: Local:
Unknown topic`

What's more, the creation logs are kind of strange.

```
10:19:53 [DBG]  Creating topics...
10:19:53 [DBG]  Trying to delete topic data-streams-1...
10:19:53 [DBG]  Trying to create topic data-streams-1...
10:19:53 [DBG]  Topic already exists
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Topic did not exist, skipping
10:19:53 [DBG]  Trying to create topic data-streams-2...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Trying to delete topic data-streams-3...
10:19:53 [DBG]  Trying to create topic data-streams-3...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Finished creating topics: 0:00:02.1158037
```

I can't really understand that sequence of logs, but deletes don't
happen atomically, so not entirely surprised by weirdness.

#7209 tried to work around it by using random topic names, but the
checkpoints are dependent on the topic names. This approach uses stable,
but unique, values

## Implementation details

Pass the topic name suffix to use to the sample from the test. This is
the approach we use in the existing non-DSM `KafkaTests` to avoid flake.

## Test coverage

The existing coverage is sufficient, but requires updating all the
snapshots.

## Other details

Supersedes #7209
chojomok pushed a commit that referenced this pull request Jul 15, 2025
## Summary of changes

Fixes flake in DSM tests by using unique but stable topic names

> Supersedes #7209

## Reason for change

[Saw some flake in a test
recently](https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=181163&view=logs&j=b7fc299e-b4c1-5ec0-1e5a-2167c3cc6270&t=2406fbf1-c048-53d0-bb5f-56f6b7adbd43):
`10:19:53 [DBG] Unhandled exception.
Confluent.Kafka.ProduceException`2[System.String,System.String]: Local:
Unknown topic`

What's more, the creation logs are kind of strange.

```
10:19:53 [DBG]  Creating topics...
10:19:53 [DBG]  Trying to delete topic data-streams-1...
10:19:53 [DBG]  Trying to create topic data-streams-1...
10:19:53 [DBG]  Topic already exists
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Trying to delete topic data-streams-2...
10:19:53 [DBG]  Topic did not exist, skipping
10:19:53 [DBG]  Trying to create topic data-streams-2...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Trying to delete topic data-streams-3...
10:19:53 [DBG]  Trying to create topic data-streams-3...
10:19:53 [DBG]  Topic created
10:19:53 [DBG]  Finished creating topics: 0:00:02.1158037
```

I can't really understand that sequence of logs, but deletes don't
happen atomically, so not entirely surprised by weirdness.

#7209 tried to work around it by using random topic names, but the
checkpoints are dependent on the topic names. This approach uses stable,
but unique, values

## Implementation details

Pass the topic name suffix to use to the sample from the test. This is
the approach we use in the existing non-DSM `KafkaTests` to avoid flake.

## Test coverage

The existing coverage is sufficient, but requires updating all the
snapshots.

## Other details

Supersedes #7209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests unit tests, integration tests type:flake-fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants