Skip to content

KTOR-10160 Fix race condition when initializing SLF4J logger in a bg thread - #6048

Open
Aleksei Tirman (Stexxe) wants to merge 2 commits into
release/3.xfrom
stexxe/slf4j-init-problem
Open

Aleksei Tirman (Stexxe) wants to merge 2 commits into
release/3.xfrom
stexxe/slf4j-init-problem

Conversation

@Stexxe

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T09:43:49.574104Z 6a86baf PR opened
🔒 Security Review ✅ Completed 2026-11-27T09:44:49.662605Z 6a86baf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Stexxe Aleksei Tirman (Stexxe) changed the title KTOR-10160 Fix race condition when initializing SLF4J logger in a bac… KTOR-10160 Fix race condition when initializing SLF4J logger in a bg thread Nov 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a86bafde7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment on lines +59 to +61
repeat(3_000) {
if (failures.isNotEmpty()) return@Thread
runApp(App::class.java, providerLookupDelayMillis = 20)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move the CPU-saturating startup loop into the stress suite

Every ordinary :ktor-utils:jvmTest run now performs 3,000 sequential simulated startups, each spending at least 40 ms in App.run(), while busy-loop threads saturate all available processors. This adds at least roughly two minutes of CPU-saturating work, plus class-loading and scheduling overhead, to the normal test suite. build-logic/src/main/kotlin/ktorbuild/targets/JvmConfig.kt already excludes *StressTest* from jvmTest and provides a separate stressTest task; move this workload there and keep the bounded provider-initialization regression test in the ordinary suite.

Useful? React with 👍 / 👎.

@bjhham

Copy link
Copy Markdown
Contributor

Who would've thought getting a logger would be so hard 😅

@bjhham Bruce Hamilton (bjhham) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can probably just drop the expensive test unless there's a better way to verify it

@Stexxe

Copy link
Copy Markdown
Contributor Author

I think you can probably just drop the expensive test unless there's a better way to verify it

Does it affect the build?

@bjhham

Copy link
Copy Markdown
Contributor

Yeah, it takes 2.5 minutes to run and creates a massive log of output. I don't know if there's a way to test it deterministically without using powermock since it's all static references.

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.

2 participants