Skip to content

Mark LoggingHandlerTest with @Isolated to fix flaky build#16338

Merged
normanmaurer merged 1 commit into
4.2from
isolated
Feb 23, 2026
Merged

Mark LoggingHandlerTest with @Isolated to fix flaky build#16338
normanmaurer merged 1 commit into
4.2from
isolated

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

As LoggingHandlerTest depends on static state we should better mark it as @Isolated so we not mess up the state sometimes by running test concurrently. Failing to do so can cause issues like:

2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more

Modifications:

Add @Isolated annotation to test class

Result:

No more test-failures

Motivation:

As LoggingHandlerTest depends on static state we should better mark it as `@Isolated` so we not mess up the state sometimes by running test concurrently. Failing to do so can cause issues like:

```
2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more
```

Modifications:

Add `@Isolated` annotation to test class

Result:

No more test-failures
@normanmaurer normanmaurer added this to the 4.2.11.Final milestone Feb 23, 2026
@chrisvest chrisvest added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Feb 23, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Feb 23, 2026
@normanmaurer normanmaurer merged commit 4e38d60 into 4.2 Feb 23, 2026
20 of 24 checks passed
@normanmaurer normanmaurer deleted the isolated branch February 23, 2026 20:07
netty-project-bot pushed a commit that referenced this pull request Feb 23, 2026
Motivation:

As LoggingHandlerTest depends on static state we should better mark it
as `@Isolated` so we not mess up the state sometimes by running test
concurrently. Failing to do so can cause issues like:

```
2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more
```

Modifications:

Add `@Isolated` annotation to test class

Result:

No more test-failures

(cherry picked from commit 4e38d60)
@netty-project-bot
Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #16340

@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Feb 23, 2026
netty-project-bot pushed a commit that referenced this pull request Feb 23, 2026
Motivation:

As LoggingHandlerTest depends on static state we should better mark it
as `@Isolated` so we not mess up the state sometimes by running test
concurrently. Failing to do so can cause issues like:

```
2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more
```

Modifications:

Add `@Isolated` annotation to test class

Result:

No more test-failures

(cherry picked from commit 4e38d60)
@netty-project-bot
Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #16341

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Feb 23, 2026
chrisvest pushed a commit that referenced this pull request Feb 23, 2026
…ild (#16340)

Auto-port of #16338 to 4.1
Cherry-picked commit: 4e38d60

---
Motivation:

As LoggingHandlerTest depends on static state we should better mark it
as `@Isolated` so we not mess up the state sometimes by running test
concurrently. Failing to do so can cause issues like:

```
2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more
```

Modifications:

Add `@Isolated` annotation to test class

Result:

No more test-failures

Co-authored-by: Norman Maurer <[email protected]>
normanmaurer added a commit that referenced this pull request Feb 24, 2026
…ild (#16341)

Auto-port of #16338 to 5.0
Cherry-picked commit: 4e38d60

---
Motivation:

As LoggingHandlerTest depends on static state we should better mark it
as `@Isolated` so we not mess up the state sometimes by running test
concurrently. Failing to do so can cause issues like:

```
2026-02-21T04:13:33.0279489Z [ERROR] io.netty.handler.logging.LoggingHandlerTest -- Time elapsed: 0.095 s <<< ERROR!
2026-02-21T04:13:33.0281038Z java.lang.ExceptionInInitializerError
2026-02-21T04:13:33.0282266Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0284143Z 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
2026-02-21T04:13:33.0285193Z 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
2026-02-21T04:13:33.0286182Z 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
2026-02-21T04:13:33.0287200Z 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
2026-02-21T04:13:33.0288167Z 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2026-02-21T04:13:33.0289364Z 	Suppressed: java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.logging.LoggingHandlerTest
2026-02-21T04:13:33.0290429Z 		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2026-02-21T04:13:33.0291123Z 		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
2026-02-21T04:13:33.0291996Z 		at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
2026-02-21T04:13:33.0292740Z 		... 5 more
2026-02-21T04:13:33.0294696Z Caused by: java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.SubstituteLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
2026-02-21T04:13:33.0296729Z 	at io.netty.handler.logging.LoggingHandlerTest.<clinit>(LoggingHandlerTest.java:61)
2026-02-21T04:13:33.0297699Z 	... 6 more
```

Modifications:

Add `@Isolated` annotation to test class

Result:

No more test-failures

Co-authored-by: Norman Maurer <[email protected]>
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