Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8251361

Potential race between Logger configuration and GCs in HttpURLConWithProxy test

XMLWordPrintable

    • b11

        The issue was reported on the net-dev mailing list:
        https://mail.openjdk.java.net/pipermail/net-dev/2020-July/014191.html

        There is a subtle timing hole introduced into the HttpURLConWithProxy.java test with the fix for JDK-8183369.
        When using GC stress modes, a consistent failure can be observed:

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

        It can be 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.

        Since the test relies on the log messages being handled by the new ProxyHandler to pass, the test needs to ensure the Logger object stays live for the entire lifetime of the test.

              dfuchs Daniel Fuchs
              dfuchs Daniel Fuchs
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: