Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Log4j 2 to 2.24.1 #498

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

Marcono1234
Copy link
Contributor

@Marcono1234 Marcono1234 commented Oct 8, 2024

This also needs a test dependency on log4j-core because since version 2.24.0 if no provider implementation is found a no-op ThreadContextMap is used, which causes test failures. See also apache/logging-log4j2#2946 (comment) for more details.

However, for normal usage that is probably not relevant since there the user most likely will have some variant of Log4j provider, most likely log4j-core as runtime dependency (but possibly also another provider).

This also needs a test dependency on log4j-core because since version
2.24.0 if no provider implementation is found a no-op ThreadContextMap
is used, which causes test failures.

However, for normal usage that is probably not relevant since there the
user most likely will have some variant of Log4j provider, most likely
log4j-core as runtime dependency (but possibly also another provider).

Signed-off-by: Marcono1234 <Marcono1234@users.noreply.github.com>
@Marcono1234
Copy link
Contributor Author

Marcono1234 commented Oct 8, 2024

A bit unrelated, but is ContextAwareCompletableFutureTest flaky?
In my fork I just got a test failure there:

Test failure (click to expand)

https://github.com/Marcono1234/context-propagation/actions/runs/11245200679/job/31264757917#step:8:663

 Error:  Tests run: 82, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.202 s <<< FAILURE! -- in nl.talsmasoftware.context.futures.ContextAwareCompletableFutureTest
Error:  nl.talsmasoftware.context.futures.ContextAwareCompletableFutureTest.testRunAfterEitherAsyncAndTakeNewSnapshot -- Time elapsed: 0.010 s <<< ERROR!
java.util.concurrent.ExecutionException: 
java.lang.AssertionError: 
Expected: a string starting with "-"
     but: was "Glass of beer"
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
	at nl.talsmasoftware.context.futures.ContextAwareCompletableFutureTest.testRunAfterEitherAsyncAndTakeNewSnapshot(ContextAwareCompletableFutureTest.java:1816)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
Caused by: java.lang.AssertionError: 
Expected: a string starting with "-"
     but: was "Glass of beer"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
	at nl.talsmasoftware.context.futures.ContextAwareCompletableFutureTest.lambda$testRunAfterEitherAsyncAndTakeNewSnapshot$356(ContextAwareCompletableFutureTest.java:1815)
	at nl.talsmasoftware.context.functions.ConsumerWithContext.accept(ConsumerWithContext.java:55)
	at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:670)
	at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:646)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
	at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
	at nl.talsmasoftware.context.futures.ContextAwareCompletableFuture.lambda$wrap$0(ContextAwareCompletableFuture.java:478)
	at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
	at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
	at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:575)
	at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:1068)
	at java.util.concurrent.CompletableFuture$OrRun.tryFire(CompletableFuture.java:1495)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

Maybe the use of runAfterEitherAsync (and also the other either methods) creates a race condition there, where the first initializeNewContext call is actually executed second?
(might affect multiple test methods)

@sjoerdtalsma
Copy link
Contributor

A bit unrelated, but is ContextAwareCompletableFutureTest flaky? In my fork I just got a test failure there:

Thanks! I created a separate issue for this to look into. It seems you could be on the right track with the either, but perhaps I personally have a JDK with a prejudice in the 'either' decision as I have not yet seen had this specific test fail on my machine.
But worth checking out to be sure.

@sjoerdtalsma sjoerdtalsma merged commit 2939050 into talsma-ict:develop Oct 9, 2024
3 checks passed
@Marcono1234 Marcono1234 deleted the log4j2-update branch October 9, 2024 20:41
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