Skip to content

Change the order of executors shutdown in drainAndShutdownExecutors to fix flaky integration tests#2884

Merged
0xnm merged 1 commit into
developfrom
nogorodnikov/change-order-of-executors-shutdown-in-drainAndShutdownExecutors
Sep 17, 2025
Merged

Change the order of executors shutdown in drainAndShutdownExecutors to fix flaky integration tests#2884
0xnm merged 1 commit into
developfrom
nogorodnikov/change-order-of-executors-shutdown-in-drainAndShutdownExecutors

Conversation

@0xnm

@0xnm 0xnm commented Sep 16, 2025

Copy link
Copy Markdown
Member

The following test is quite flaky com.datadog.android.sdk.integration.security.EncryptionTest > must_encrypt_all_data and it may be after we introduced feature context synchronization.

I didn't manage to have this test failing on my local machine, but on CI it happens sometimes.

Probably, the issue is related to the way flushAndShutdownExecutors does the flush/shutdown sequence under the hood, so this PR first makes sure all context thread tasks are processed before shutting down I/O executors (well, mostly considering persistence executor), because tasks on the context thread may spin off tasks for the I/O thread.

Hopefully, this will solve the issue, but I'm not 100% sure (since I cannot reproduce it locally).

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested review from a team as code owners September 16, 2025 14:32
@codecov-commenter

codecov-commenter commented Sep 16, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.58%. Comparing base (be780c5) to head (b672e6d).
⚠️ Report is 1444 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2884      +/-   ##
===========================================
- Coverage    70.60%   70.58%   -0.02%     
===========================================
  Files          810      810              
  Lines        29671    29674       +3     
  Branches      5081     5081              
===========================================
- Hits         20948    20945       -3     
- Misses        7295     7297       +2     
- Partials      1428     1432       +4     
Files with missing lines Coverage Δ
...n/com/datadog/android/core/internal/CoreFeature.kt 84.62% <100.00%> (+0.14%) ⬆️

... and 39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xnm
0xnm merged commit 80a46ee into develop Sep 17, 2025
27 checks passed
@0xnm
0xnm deleted the nogorodnikov/change-order-of-executors-shutdown-in-drainAndShutdownExecutors branch September 17, 2025 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants