-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8346952 : GetGraphicsStressTest.java fails: Native resources unavailable #25619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 8 commits
c084cc8
d3f4ec6
ba8d753
d3cfe00
268e79c
7831957
c3348d7
af7209e
3175a0f
1eba0fc
bfc4ac1
577ba84
9103d25
9262aa7
61906dd
0a02b31
ba8e40f
9434c98
e458e6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2497,33 +2497,24 @@ jint AwtWindow::_GetScreenImOn(void *param) | |
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); | ||
|
||
jobject self = (jobject)param; | ||
jint result = -1; | ||
PDATA pData; | ||
AwtWindow* w = NULL; | ||
|
||
// It's entirely possible that our native resources have been destroyed | ||
// before our java peer - if we're dispose()d, for instance. | ||
// Alert caller w/ IllegalComponentStateException. | ||
if (self == NULL) { | ||
JNU_ThrowByName(env, "java/awt/IllegalComponentStateException", | ||
"Peer null in JNI"); | ||
return 0; | ||
} | ||
PDATA pData = JNI_GET_PDATA(self); | ||
if (pData == NULL) { | ||
JNU_ThrowByName(env, "java/awt/IllegalComponentStateException", | ||
"Native resources unavailable"); | ||
env->DeleteGlobalRef(self); | ||
return 0; | ||
} | ||
// Return the default screen. | ||
JNI_CHECK_PEER_GOTO(self, ret); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest reordering it slightly - this pattern is commonly used in most cases where JNI_CHECK_PEER_GOTO is used:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still suggest this order. Also, please add the new bug ID to the GetGraphicsStressTest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cant reproduce it locally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the stack trace when the new test fails? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same stack as the old test. However let me try to enhance it and come back to you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @mrserb, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @mrserb, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looking into it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is unclear from the diff, but does the PDATA pData have additional space at the beginning? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. it's handled now |
||
|
||
jint result = 0; | ||
AwtWindow *w = (AwtWindow *)pData; | ||
w = (AwtWindow *)pData; | ||
if (::IsWindow(w->GetHWnd())) | ||
{ | ||
result = (jint)w->GetScreenImOn(); | ||
} | ||
|
||
ret: | ||
env->DeleteGlobalRef(self); | ||
|
||
return result; | ||
return (result != -1) ? result : AwtWin32GraphicsDevice::GetDefaultDeviceIndex(); | ||
} | ||
|
||
void AwtWindow::_SetFocusableWindow(void *param) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
import java.awt.Frame; | ||
|
||
/** | ||
* @test | ||
* @bug 8346952 | ||
* @summary Floods the EDT with updateGC() events then brutally disposes the frame. | ||
* @key headful | ||
*/ | ||
|
||
public final class NotifyStressTest { | ||
static volatile Throwable failed; | ||
|
||
public static void main(final String[] args) throws Exception { | ||
Thread.setDefaultUncaughtExceptionHandler((t, e) -> failed = e); | ||
|
||
Frame frame = new Frame(); | ||
frame.setSize(100, 100); | ||
frame.setLocationRelativeTo(null); | ||
frame.setVisible(true); | ||
|
||
for (int i = 0; i < 256; i++) { | ||
frame.removeNotify(); | ||
frame.addNotify(); | ||
} | ||
|
||
frame.dispose(); | ||
if (failed != null) { | ||
System.err.println("Test failed"); | ||
failed.printStackTrace(); | ||
throw new RuntimeException(failed); | ||
} | ||
|
||
// let the system recover from the notify flood | ||
Thread.sleep(5000); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.