Fix potential race between Logger configuration and GCs in HttpURLConWithProxy test

Charlie Gracie Charlie.Gracie at microsoft.com
Thu Jul 23 14:21:38 UTC 2020


Hi Daniel,

Thanks for the review!

Yep, I will need a sponsor for this.

Cheers,
Charlie Gracie

On 2020-07-23, 8:38 AM, "Daniel Fuchs" <daniel.fuchs at oracle.com> wrote:
> Hi Charlie,
>
> Thanks for finding and fixing this!
> I have fixed many such failures in the logging tests in
> the past.
>
> Your changes look good to me.
>
> Reviewed.
>
> Do you need a sponsor for this?
>
> best regards,
>
> -- daniel
>
>On 22/07/2020 20:38, Charlie Gracie wrote:
> > Hi,
> > 
> > I believe there was a subtle timing hole introduced into the HttpURLConWithProxy.java 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:
> > http://cr.openjdk.java.net/~burban/cgracie/logger_fix/webrev0.0/
> > 
> > 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.
> > -vmoption:-XX:+UseShenandoahGC
> > -vmoption:-XX:+UnlockDiagnosticVMOptions
> > -vmoption:-XX:ShenandoahGCHeuristics=aggressive
> > 
> > Thanks,
> > Charlie Gracie
> > 
> > [1] https://bugs.openjdk.java.net/browse/JDK-8183369
> > [2] https://docs.oracle.com/en/java/javase/14/docs/api/java.logging/java/util/logging/Logger.html#getLogger(java.lang.String)
> > 
> >     
    



More information about the net-dev mailing list