-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Prefer system-wide JRE installation if compatible with shipped IDE (workaround for problems on MacOSX and external monitor) #10234
Conversation
Doing this allows us to keep bundling OpenJDK (or AdoptJDK) with all its bugs, while using the systemwide JRE (normally Oracle's) if it matches the requisites. On MacOS, these lines from appbundler should be reversed (and probably the version checked more strictly) https://github.com/arduino/appbundler/blob/ae/appbundler/native/main.m#L159-L175
This version will use system-wide installed JRE and fallback to bundled JRE if no system JVM is installed.
Looks like version 8u252 may have fixed the terrible OpenJDK bugs we've been seeing. I created a test copy of Arduino 1.8.12 with the 8u242 replaced with version 8u252. Just got feedback on the forum from a user who was experiencing the crashes that 8u252 seems to fix the problem. https://forum.arduino.cc/index.php?topic=661342.msg4607373#msg4607373 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message says "while using the systemwide JRE (normally Oracle's) if it matches the requisites.", but what requisites are these? On Linux apparently "not OpenJDK", but what are these on Windows? Is that just <runtimeBits>32</runtimeBits>
maybe?
export JAVA_TOOL_OPTIONS=`echo $JAVA_TOOL_OPTIONS | sed 's|-javaagent:/usr/share/java/jayatanaag.jar||g'` | ||
|
||
JAVA=java | ||
if [ -x "$APPDIR/java/bin/java" ]; then | ||
|
||
#check systemwide java version, prefer Oracle jre |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems confusing. This does not prefer oracle jre, AFAICS it prefers the system-wide JRE, except when its OpenJDK, then it prefers the bundled version (which is also OpenJDK IIUC, but then at least a version with known problems :-p).
fi | ||
|
||
if [[ -x "$APPDIR/java/bin/java" && x$SYSTEM_OPENJDK != "x" ]]; then | ||
echo "Using bundled Java JRE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have an else
that says "Using system Java JRE"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
More good news. A 2nd user experiencing the Mac crashes has confirmed 8u252 fixes the problem. |
Both appbundler and launch4j already enforce that the "fallback" (or after this patch, the preferred one) are java8 with the correct "bitness" (only applies on Win since macOS has been 64bit only for such a long time) |
This is great news! @cmaglie time to spin up the JRE compile task? |
FWIW, I did it the lazy way, just downloaded "OpenJDK8U-jre_x64_mac_hotspot_8u252b09.tar.gz" from the AdoptOpenJDK site. No compile needed, as they're now building it for SDK 10.10 which passes Apple's notarization requirements. I just extracted it, renamed the folder to "jre1.8.0_242.jre", and put it in 1.8.12's Contents/PlugIns folder. Then I signed, notarized and stapled the whole IDE. No rebuilding the JRE needed. :) |
Well, and some not-so-awesome news. One of those users now reports the fix is only partial. Apparently still crashes when used on a 2nd monitor, but at least now seems to be stable on the primary display. Details on the forum. |
Ohh finally! I tried the 8u252 as soon as it was published, but it wasn't build yet with latest Apple SDK, I guess they updated the builder later.
I tested 8u252 (with the help of my collegue that was experiencing the issue on his mac) and it was still crashing, so I have to add another +1 on the "negative" side... |
Here a preview build for MacOSX, it's signed+notarized: This build bundles the latest OpenJDK 8u252 from AdoptOpenJDK, that solves the external monitor issue in some cases (not all). In case you still experience the issue, with this release the workaround is to install the Oracle JRE 8 in your system after downloading it from this website https://www.java.com/download, once installed run the IDE again and it should now use the Oracle JRE instead of the bundled one hopefully solving the problem. |
@makermelissa @emha69 @VASAPOL @ccohen20 @kako21 @ghost @CharlieBouyaka
Thanks! |
Hi,
it works better, since it does not crash immediately as before, but it is still crashing. It can be easily reproduced by simply moving and dropping the IDE window from one monitor/desktop to the another.
Updating to Java 8 U251 did not solved the problem. It crashes anyway, reports below.
Without Java update:
```
Process: Arduino [4764]
Path: /Applications/Dev Tools/Arduino-Beta.app/Contents/MacOS/Arduino
Identifier: cc.arduino.Arduino
Version: 1.8.13 (1.8.13)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Arduino [4764]
User ID: 501
Date/Time: 2020-06-05 16:49:19.956 +0200
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Bridge OS Version: 3.0 (14Y908)
Anonymous UUID: 7AE9F4C1-29E8-4340-89DD-AEA61EFAE1D5
Time Awake Since Boot: 36000 seconds
System Integrity Protection: enabled
Crashed Thread: 27 Java: Java2D Queue Flusher
Exception Type: EXC_BAD_INSTRUCTION (SIGABRT)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
-[NSOpenGLContext setView:] must be called from the main thread.
Thread 27 Crashed:: Java: Java2D Queue Flusher
0 libsystem_kernel.dylib 0x00007fff6bdfc33a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6beb8e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff6bd83808 abort + 120
3 libjvm.dylib 0x0000000106c54d2e os::abort(bool) + 22
4 libjvm.dylib 0x0000000106d5c0b2 VMError::report_and_die() + 2148
5 libjvm.dylib 0x0000000106c5925c JVM_handle_bsd_signal + 529
6 libjvm.dylib 0x0000000106c56c2c signalHandler(int, __siginfo*, void*) + 45
7 libsystem_platform.dylib 0x00007fff6bead5fd _sigtramp + 29
8 ??? 000000000000000000 0 + 0
9 libawt_lwawt.dylib 0x000000011b48b16b CGLSD_MakeCurrentToScratch + 71
10 libawt_lwawt.dylib 0x000000011b48b27f OGLSD_MakeOGLContextCurrent + 99
11 libawt_lwawt.dylib 0x000000011b4a7cbd OGLContext_SetSurfaces + 133
12 libawt_lwawt.dylib 0x000000011b4abb32 Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer + 1578
13 ??? 0x00000001079ce407 0 + 4422689799
14 ??? 0x00000001079bdffd 0 + 4422623229
15 ??? 0x000000010865765c 0 + 4435834460
16 ??? 0x00000001079b64e7 0 + 4422591719
17 libjvm.dylib 0x0000000106abf32f JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1681
18 libjvm.dylib 0x0000000106abe17b JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 325
19 libjvm.dylib 0x0000000106abe357 JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 87
20 libjvm.dylib 0x0000000106b0ed89 thread_entry(JavaThread*, Thread*) + 120
21 libjvm.dylib 0x0000000106d2138a JavaThread::thread_main_inner() + 130
22 libjvm.dylib 0x0000000106d2124f JavaThread::run() + 409
23 libjvm.dylib 0x0000000106c54863 java_start(Thread*) + 250
24 libsystem_pthread.dylib 0x00007fff6beb9109 _pthread_start + 148
25 libsystem_pthread.dylib 0x00007fff6beb4b8b thread_start + 15
```
After Java update:
```
Process: Arduino [4932]
Path: /Applications/Dev Tools/Arduino-Beta.app/Contents/MacOS/Arduino
Identifier: cc.arduino.Arduino
Version: 1.8.13 (1.8.13)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Arduino [4932]
User ID: 501
Date/Time: 2020-06-05 16:58:30.796 +0200
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Bridge OS Version: 3.0 (14Y908)
Anonymous UUID: 7AE9F4C1-29E8-4340-89DD-AEA61EFAE1D5
Time Awake Since Boot: 36000 seconds
System Integrity Protection: enabled
Crashed Thread: 26 Java: Java2D Queue Flusher
Exception Type: EXC_BAD_INSTRUCTION (SIGABRT)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Thread 26 Crashed:: Java: Java2D Queue Flusher
0 libsystem_kernel.dylib 0x00007fff6bdfc33a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6beb8e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff6bd83808 abort + 120
3 libjvm.dylib 0x000000010ba615c1 os::abort(bool) + 25
4 libjvm.dylib 0x000000010bb8dff6 VMError::report_and_die() + 2306
5 libjvm.dylib 0x000000010ba63206 JVM_handle_bsd_signal + 1131
6 libjvm.dylib 0x000000010ba5f44b signalHandler(int, __siginfo*, void*) + 47
7 libsystem_platform.dylib 0x00007fff6bead5fd _sigtramp + 29
8 ??? 0x0000600001c48000 0 + 105553145921536
9 libawt_lwawt.dylib 0x00000001207345b3 CGLSD_MakeCurrentToScratch + 99
10 libawt_lwawt.dylib 0x0000000120734d25 OGLSD_MakeOGLContextCurrent + 123
11 libawt_lwawt.dylib 0x00000001207535f4 OGLContext_SetSurfaces + 136
12 libawt_lwawt.dylib 0x00000001207564b3 Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer + 1535
13 ??? 0x0000000111147667 0 + 4581520999
14 ??? 0x00000001111372bd 0 + 4581454525
15 ??? 0x00000001111372bd 0 + 4581454525
16 ??? 0x00000001111372bd 0 + 4581454525
17 ??? 0x000000011112f7a7 0 + 4581423015
18 libjvm.dylib 0x000000010b8c29b2 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1710
19 libjvm.dylib 0x000000010b8c3156 JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 356
20 libjvm.dylib 0x000000010b8c3302 JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) + 74
21 libjvm.dylib 0x000000010b91db2e thread_entry(JavaThread*, Thread*) + 124
22 libjvm.dylib 0x000000010bb47d6b JavaThread::thread_main_inner() + 155
23 libjvm.dylib 0x000000010bb4947c JavaThread::run() + 450
24 libjvm.dylib 0x000000010ba61e2a java_start(Thread*) + 246
25 libsystem_pthread.dylib 0x00007fff6beb9109 _pthread_start + 148
26 libsystem_pthread.dylib 0x00007fff6beb4b8b thread_start + 15
```
|
@emha69 thanks you for testing, that's very bad news!
It should print some debugging output, if you can copy & paste here, thanks. |
Log files attached.
|
github eat the attachment, please send to c.maglie AT arduino.cc |
thank you for your reply
devices used :
1 MacBook Pro (MBP)
1 external monitor (EM)
workflow :
1 :
MBP open, EM on.
Arduino 1.8.13 launch, 1 sketch open, closing of the MBP, sketch transferred to EM. OK
2 :
MBP open, EM on.
Arduino 1.8.13 launch, 2 sketch open, closing of the MBP, Arduino crashed.
3 :
MBP closed, EM on.
Arduino 1.8.13 launch, 1 sketch open. OK
Jacques Caillot
… Le 5 juin 2020 à 16:00, Cristian Maglie ***@***.***> a écrit :
@makermelissa <https://github.com/makermelissa> @emha69 <https://github.com/emha69> @VASAPOL <https://github.com/VASAPOL> @ccohen20 <https://github.com/ccohen20> @kako21 <https://github.com/kako21> @ghost <https://github.com/ghost> @CharlieBouyaka <https://github.com/CharlieBouyaka>
I know from previous issues that you have got crash of the Arduino IDE with MacOSX and external monitor setup. May I ask you to test the version here https://downloads.arduino.cc/arduino-1.8.13-preview-macosx.zip <https://downloads.arduino.cc/arduino-1.8.13-preview-macosx.zip> and to tell me:
If running the Arduino IDE above solves the second-monitor-crash issue.
If the issue is not solved -> install the Oracle Java Virtual Machine downloaded from https://www.java.com/download <https://www.java.com/download> and re run the IDE afterwards
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#10234 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/APEPVONAPNYHAVXX5YS2LFLRVD26LANCNFSM4NEECZXQ>.
|
In case it is helpful, I tried running the version from https://downloads.arduino.cc/arduino-1.8.13-preview-macosx.zip. It crashed, so I downloaded the linked Java updater (jre-8u251-macosx-x64) and removed java installation via that tool instead of installing it. That ran for a few minutes before crashing. I then tried running the updater again and installing it, but it crashed again. |
ok, thanks to these test and the logs sent by @emha69 I've made some more test and I discovered that:
At this point the only possible explanation is that something happened between 1.8.12 and 1.8.10 so I started a git bisection and the breaking commit is 76699fd:
Indeed, if I replace appbundler with the previous version it works again! (but we cannot notarize the app anymore...) So to recap: there is something with the new appbundler that makes the app crash but we cannot use the old appbundler becuase it can't be notarized. Tomorrow I will make some more investigation, just wanted to make a heads up here too just in case someone has some ideas... The latest appbundler has been build from here: https://github.com/arduino/appbundler/tree/ae |
Hello All, Regards, |
Crash have been reported if app launcher is build with the latest SDK. See github.com/arduino/Arduino/pull/10234
@emha69 @missingnoodle @kako21 @fgreen Can you please test this version: |
For me, this build worked! Thank you! By works I mean: The hardware I tested on: Display Configuration (4 displays total) Unfortunately there is one variable that is in play for my testing, that may play a part in the success, but I cannot verify.
Regards, |
Regarding, testing against the 10.15.6 beta 2 release. At least I can verify, that having built the app bundler against the 10.9 SDK, hasn't seemed to have any side effects/regressions, in my brief testing, against the latest and greatest OS X beta build. |
Thanks @missingnoodle, Even if the commit you linked was not related, I finally ended up here TheInfiniteKind/appbundler#70 and the discussion made me think about this solution. So... yeah, a very small and simple patch but really hard to find. |
No problem. Isn't almost always the case, a solution, being small and simple, yet, difficult to find/resolve... I'm glad my post helped lead you to thinking about the solution you presented. As I am not a committer, nor familiar with the codebase, I did not want to presume anything, but hoped my referencing the commit that I did would lead to a positive result. |
Hi,
I have tested the 1.18.13 preview 2 on Mac with recent Catalina 10.15.5 and it works like charm now.
Regards,
M.
|
Hi, Replying here instead of #10349 because It is duplicate and closed. Tested the Preview provided and works for me. Confirmed the nightly build still crashes and then tested this all working well. Tried minimise maximise on each screen moving between and scrolling while between all three monitors. Macbook Pro 11,1 Iris graphics 2 additional monitors over USB3 hub. |
This new version works perfectly With 2 external screens and that of MacBoo Pro.
Good work. Thank you
JC
|
Superseded by #10357 |
To make Java IDE more future-proof (and avoid these kind of issues) one of the possible actions is to reverse the priority of the bundled JRE.
Doing this allows us to keep bundling OpenJDK (or AdoptJDK) with all its bugs (or older versions of Oracle's JRE from before the license change), while using the system-wide JRE if it matches the requirements.
Linux version of the patch still uses bundled JRE if the system one self reports as
openjdk
to avoid strange issues with distro provided JREs. I'm not 100% sure it's the right decision but we can test it and see if it makes sense@alranel @cmaglie @PaulStoffregen
All Submissions:
New Feature Submissions:
Changes to Core Features: