JDK-8191169 : java/net/Authenticator/B4769350.java failed intermittently
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 10,14
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-11-14
  • Updated: 2022-01-05
  • Resolved: 2021-04-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.11-oracleFixed 13.0.4Fixed 14 b11Fixed
Related Reports
Relates :  
Description
----------System.out:(2/53)----------
Server: listening on port: 24633
Doing Proxy tests
----------System.err:(16/1011)----------
java.lang.RuntimeException: Authenticator was called 3 times. Should be: 2
	at B4769350.except(B4769350.java:472)
	at B4769350.doProxyTests(B4769350.java:438)
	at B4769350.runTest(B4769350.java:462)
	at B4769350.main(B4769350.java:447)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:844)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Authenticator was called 3 times. Should be: 2
JavaTest Message: shutting down test
Comments
Fix request (13u) Requesting backport to 13u for parity with 11u, applies cleanly.
26-05-2020

jdk11 backport request I would like to have the patch in jdk11 as well, because the issue is present there too. The patch applies cleanly (except one COPYRIGHT year).
20-03-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/d372747e8f08 User: dfuchs Date: 2019-08-19 10:18:12 +0000
19-08-2019

Needs more investigation. Might or might not be related to JDK-8223783. That is - if there is a retry and a new connection is opened the authenticator might be called once more. The handlers on the server side are registered with distinctive path so it is unlikely that they could be invoked randomly by stray clients from other tests. The test now uses the loopback address so it also reduces those chances. So I believe it's unlikely that some stray request originating from another test might have disturbed the server state, causing it to request authentication once more (but who knows). In addition, the "MyAuthenticator" should only be invoked by the client side - which means HttpURLConnection (and never by the server). Which means that more probably either the test logic is wrong, or we fail into one of these dark corners of networking (e.g. unexpected communication error causing a silent retry). That could be also the case for JDK-8223783. The test could be instrumented to save a stack trace whenever the authenticator is called, and whether it was for proxy or server, and if the authentication count is wrong then those stack traces could be spit.
27-06-2019