On Tue, 1 Apr 2025 05:57:55 GMT, David Holmes <dhol...@openjdk.org> wrote:

> See bug report for gory details.
> 
> Short version: in the Windows version of `VirtualMachineImpl::execute`, if an 
> exception occurred after we created the `SocketInputStreamImpl` (which is the 
> test scenario of the failing test), we would close the native `HANDLE` to the 
> pipe twice. But after the first close the `HANDLE` could be reassigned to 
> another object (e.g. the `_ParkHandle` of the `StreamPumper` thread) and the 
> second close would close that `HANDLE`  resulting in the failure of 
> `WaitForSingleObject`. (Other failure modes with different invalid handles 
> have also been seen.)
> 
> Fix: shorten the outer try/catch block so that we only directly close the 
> pipe if the `IOException` happens before we create the `SocketStreamImpl` - 
> after which the closing of the stream will close the pipe `HANDLE`.
> 
> Testing:
>  - ran the com/sun/tools/attach tets group 2500 times without failure
>  - tiers 3-5 as a sanity check (Windows only)
> 
> Thanks

This pull request has now been integrated.

Changeset: e6fe2490
Author:    David Holmes <dhol...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/e6fe2490bc48acf01ccf81b38d578d20ed09f238
Stats:     26 lines in 1 file changed: 14 ins; 11 del; 1 mod

8323100: com/sun/tools/attach/StartManagementAgent.java failed with 
"WaitForSingleObject failed"

Reviewed-by: kevinw, amenkov

-------------

PR: https://git.openjdk.org/jdk/pull/24346

Reply via email to