RFR: JDK-8318736: com/sun/jdi/JdwpOnThrowTest.java failed with "transport error 202: bind failed: Address already in use"
Alex Menkov
amenkov at openjdk.org
Wed Oct 25 23:33:43 UTC 2023
On Wed, 25 Oct 2023 11:27:18 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:
> Fix race condition in debugger port selection, introduced with [JDK-8317920](https://bugs.openjdk.org/browse/JDK-8317920).
>
> Tested on my Mac M1, but it doesn't contain platform-dependent code.
test/jdk/com/sun/jdi/lib/jdb/Debuggee.java line 106:
> 104:
> 105: // required to pass non null port with address and emit string before the throw
> 106: public Launcher enableOnThrow(String value, String expectedOutputBeforeThrow) {
Suggestion:
public Launcher enableOnThrow(String exceptionClassName) {
expectedOutputBeforeThrow is not needed.
Comment for the method is obsolete
test/jdk/com/sun/jdi/lib/jdb/Debuggee.java line 136:
> 134:
> 135: // starts the process, waits for "Listening for transport" output and detects transport/address
> 136: private Debuggee(ProcessBuilder pb, String name, boolean hasOnThrow, String expectedOutputBeforeThrow) {
expectedOutputBeforeThrow is not used/not neded
test/jdk/com/sun/jdi/lib/jdb/Debuggee.java line 136:
> 134:
> 135: // starts the process, waits for "Listening for transport" output and detects transport/address
> 136: private Debuggee(ProcessBuilder pb, String name, boolean hasOnThrow, String expectedOutputBeforeThrow) {
Launcher prepares command line and address detection logic depends on on the command line, so I think it would be better to make
Suggestion:
private Debuggee(ProcessBuilder pb, String name, Function<String, JDWP.ListenAddress> addressDetector) {
then warm-up predicate in the ctor uses `listenAddress[0] = addressDetector.apply(s)`
Launcher.launch() can pass JDWP::parseListenAddress for usual cases and implement the detector for onthrow case
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16358#discussion_r1372415102
PR Review Comment: https://git.openjdk.org/jdk/pull/16358#discussion_r1372403856
PR Review Comment: https://git.openjdk.org/jdk/pull/16358#discussion_r1372413049
More information about the serviceability-dev
mailing list