On Thu, 28 Dec 2023 09:48:52 GMT, Matthias Baesken <[email protected]> wrote:
> When running with fastdebug binaries we run intermittent into the issue below > in > jtreg test > java/awt/image/MultiResolutionImage/MultiResolutionImageObserverTest.java . > Seems we miss checking of successful HBITMAP creation before calling > GetDIBits. > > HDC hBMDC = this->GetDC(); > HBITMAP hBM = ::CreateCompatibleBitmap(hBMDC, 1, 1); > VERIFY(::GetDIBits(hBMDC, hBM, 0, 1, NULL, gpBitmapInfo, DIB_RGB_COLORS)); > > in awt_Win32GraphicsDevice.cpp . Thats why the releast of hBMDC / hBM fails > as well at the end of the function causing the seond and third warning. > > > Sat Nov 18 17:29:23 CET 2023 > > ********************* > AWT Assertion Failure > ********************* > ::GetDIBits(hBMDC, hBM, 0, 1, 0, gpBitmapInfo, 0) > File > 'e:\openjdk\openjdk-21u-windows_x86_64-dbg\jdk\src\java.desktop\windows\native\libawt\windows\awt_Win32GraphicsDevice.cpp', > at line 184 > GetLastError() is 57 : The parameter is incorrect. > > Do you want to break into the debugger? > ********************* > ********************* > AWT Assertion Failure > ********************* > ::DeleteObject(hBM) > File > 'e:\openjdk\openjdk-21u-windows_x86_64-dbg\jdk\src\java.desktop\windows\native\libawt\windows\awt_Win32GraphicsDevice.cpp', > at line 297 > GetLastError() is 57 : The parameter is incorrect. > > So it seems, we should have some additional checks/tracing. Hi Matthias, > But still I think the coding itself should work better also in headless mode. Then it should not only trace but fallback gracefully without calling APIs with the invalid parameters as discussed [in another thread](https://github.com/openjdk/jdk/pull/17197#discussion_r1439778065). The traces won't fix anything. According to the provided logs `hBMDC` is `NULL`, therefore `hBM` also becomes `NULL`, thus `::GetDIBits` also fails. There's already a workaround for [JDK-4684966](https://bugs.openjdk.org/browse/JDK-4684966): https://github.com/openjdk/jdk/blob/fb90af881badf143163c7d0b9961152c2a12cd84/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp#L195-L199 It should be extended to include the possible failure in the preceding call to `::GetDIBits`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17197#issuecomment-1875562325
