Fix potential race between Logger configuration and GCs in HttpURLConWithProxy test

Charlie Gracie Charlie.Gracie at
Wed Jul 22 19:38:26 UTC 2020


I believe there was a subtle timing hole introduced into the test with the
fix for JDK-8183369 [1]. In our local tests, when using GC stress modes, we consistently get a failure
reported as:

"Execution failed: `main' threw exception: java.lang.RuntimeException: Connection not retried with proxy".

I verified that the Proxy is being used but the messages are not being logged with the ProxyHandler. The
issue is caused by back to back calls of Logger.getLogger(String). If a GC happens between the two calls
there is no guarantee that the same object will be returned [2]. Since the test relies on the log messages
being handled by the new ProxyHandler to pass, it needs to ensure the Logger object lives the entire
lifetime of the test.

Here is my proposed fix:

The easiest way to reproduce is to use the following vm options when running the specific test. These options
will force the Shenandoah GC into a continuous GC mode making the test fail almost 100% of the time.

Charlie Gracie


More information about the net-dev mailing list