JDK-8314079 : Test sun/management/jmxremote/bootstrap/RmiBootstrapTest fails intermittently with cannot find a free port
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 22
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • Submitted: 2023-08-10
  • Updated: 2023-11-29
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Despite the fix in JDK 20 under JDK-8030616, it seems the problem can still arise:

----------System.out:(31/4530)----------
***
*** Testing configuration (host= 127.0.0.1 port=49154): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49156): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49157): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49158): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49159): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49160): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49161): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49162): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49163): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
***
*** Testing configuration (host= 127.0.0.1 port=49164): /System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S129695/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/80ee878a-6b9e-46d8-afb5-d167a713c5ba/runs/3eeb5717-2bd8-4d52-ae1c-8b645f3f1a2d/testoutput/test-support/jtreg_open_test_jdk_tier3/classes/4/sun/management/jmxremote/bootstrap/RmiBootstrapTest_id1.d/management_ssltest06_ok.properties
***
Test Failed: Failed: cannot find a free port after 10 tries
Comments
It would have had to try 7 more ports, to find 49171 which is not in the netstat output (49173 and 49177 are in use). We could simply increase int MAX_GET_FREE_PORT_TRIES = 10 ----------System.out:(31/4530)---------- *** *** Testing configuration (host= 127.0.0.1 port=49154): ..snip... *** Testing configuration (host= 127.0.0.1 port=49156): *** Testing configuration (host= 127.0.0.1 port=49157): *** Testing configuration (host= 127.0.0.1 port=49158): *** Testing configuration (host= 127.0.0.1 port=49159): *** Testing configuration (host= 127.0.0.1 port=49160): *** Testing configuration (host= 127.0.0.1 port=49161): *** Testing configuration (host= 127.0.0.1 port=49162): *** Testing configuration (host= 127.0.0.1 port=49163): *** Testing configuration (host= 127.0.0.1 port=49164): Test Failed: Failed: cannot find a free port after 10 tries The test uses jdk.test.lib.Utils.getFreePort() (which is working, in that there is a race, but it senses the clashes and retries) RmiBootstrapTest.java#id1 is failing The other variant RmiBootstrapTest.java#id0 starts 4 seconds earlier on the same hostname but gets ports around 65514 so it not the problem (and it passes). sun/management/jmxremote/bootstrap/RmiBootstrapTest failing sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java starts Aug 10th 2023, 12:27:10 am 2 seconds later than the failing test, and uses -Dtest.rmi.port=49170 -Dtest.rmi.port=49174 -Dtest.rmi.port=49178 ..so this is not exactly the problem, but the ports are close, and part of the reason why we'd have to extend the 10 tries significantly). RmiRegistrySslTest.java also tries 10 times to find a port, using Utils.getFreePort(). test/jdk/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java ran seconds earlier at Aug 10th 2023, 12:26:53 am and is using Address = service:jmx:rmi:///jndi/rmi://jpg-mac-x64-047.us.oracle.com:49165/jmxrmi ..so that's the next one the failing test would have tried.
10-08-2023