-
Bug
-
Resolution: Fixed
-
P4
-
8u202, 11, 12, 13, 14
-
b16
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8247225 | 13.0.4 | Sergey Bylokhov | P4 | Resolved | Fixed | b05 |
JDK-8243122 | 11.0.8-oracle | Sergey Bylokhov | P4 | Resolved | Fixed | b04 |
JDK-8243970 | 11.0.8 | Sergey Bylokhov | P4 | Resolved | Fixed | b01 |
JDK-8273728 | openjdk8u322 | Vladimir Kempik | P4 | Resolved | Fixed | b01 |
JDK-8261199 | 8u301 | Anton Litvinov | P4 | Resolved | Fixed | b01 |
JDK-8261808 | 8u291 | Anton Litvinov | P4 | Resolved | Fixed | b05 |
JDK-8262668 | emb-8u291 | Anton Litvinov | P4 | Resolved | Fixed | team |
MacBook Pro, Intel Core i7 (64 bit)
macOS Mojave 10.14.5
jdk-12.0.1.jdk / jdk-11.0.3.jdk / jdk1.8.0_212.jdk
A DESCRIPTION OF THE PROBLEM :
On recent macOS updates, like Mojave, running Java apps which uses Robot logs the following message to the Java error output:
yyyy-mm-dd hh:mm:ss.NNN java[NNN:NNN] pid(NNN)/euid(NNN) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
It looks like currently on macOS Java Robot methods (jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m) work in some background thread, but it should be performed on Main Thread.
So correctness of apps using Java Robot may possibly be affected.
For example, such message appears in Java error output during the following JDK jtreg tests run on macOS Mojave:
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run simple reproducer - NonMainThreadTest.java:
<javac> NonMainThreadTest.java
<java> NonMainThreadTest
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Empty java error output.
Specifically, no following message in the java error output:
yyyy-mm-dd hh:mm:ss.NNN java[NNN:NNN] pid(NNN)/euid(NNN) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
ACTUAL -
---
> jdk1.8.0_202.jdk/Contents/Home/bin/java -showversion NonMainThreadTest
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
Test start
2019-06-24 17:42:45.886 java[1950:42575] pid(1950)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:42:45.886 java[1950:42575] pid(1950)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:42:45.886 java[1950:42575] pid(1950)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:42:45.886 java[1950:42575] pid(1950)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
Test end
---
> jdk-11.0.3.jdk/Contents/Home/bin/java -showversion NonMainThreadTest
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
Test start
2019-06-24 17:43:12.137 java[1952:42798] pid(1952)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:43:12.137 java[1952:42798] pid(1952)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:43:12.138 java[1952:42798] pid(1952)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:43:12.138 java[1952:42798] pid(1952)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
Test end
---
> jdk-12.0.1.jdk/Contents/Home/bin/java -showversion NonMainThreadTest
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
Test start
2019-06-24 17:43:27.710 java[1953:42931] pid(1953)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-06-24 17:43:27.710 java[1953:42931] pid(1953)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
...
2019-06-24 17:43:27.712 java[1953:42931] pid(1953)/euid(502) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
Test end
---
---------- BEGIN SOURCE ----------
---
import java.awt.Frame;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class NonMainThreadTest {
public static void main(String[] args) throws Exception {
System.out.println("Test start");
Frame frame = new Frame();
frame.setSize(100, 100);
frame.setVisible(true);
Robot robot = new Robot();
robot.setAutoDelay(100);
int anyKey = KeyEvent.VK_ESCAPE;
robot.keyPress(anyKey);
robot.keyRelease(anyKey);
robot.waitForIdle();
frame.dispose();
System.out.println("Test end");
}
}
---
---------- END SOURCE ----------
FREQUENCY : always
- backported by
-
JDK-8243122 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8243970 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8247225 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8261199 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8261808 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8262668 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
-
JDK-8273728 [macOS 10.14] Methods of Java Robot should be called from appropriate thread
-
- Resolved
-
- duplicates
-
JDK-8214166 java/awt/event/KeyEvent/SwallowKeyEvents: call TIS/TSM in main thread
-
- Closed
-
-
JDK-8249874 Invoking java.awt.Robot#keyPress crashes the JVM | OpenJDK14.0.1+14
-
- Closed
-
-
JDK-8238208 Lanai: a lot of crashes at [libdispatch.dylib+0x4769] _dispatch_assert_queue_fail+0x63
-
- Closed
-
- links to