Bug 1402819

Summary: Coredump calling java.awt.Robot#createScreenCapture in wayland mode
Product: [Fedora] Fedora Reporter: Frank Büttner <bugzilla>
Component: java-1.8.0-openjdkAssignee: Zhengyu <zgu>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: ahughes, dbhole, fedora, iweiss, jerboaa, jvanek, mark.harfouche, Mauri.Sahlberg, mikko.tiihonen, msrb, omajid, peljasz, sgehwolf, troels, william.ferguson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: java-1.8.0-openjdk-1.8.0.172-5.b11.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-25 13:57:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
hotspot error log file.
none
Simple reproducer
none
Patch to avoid the crash none

Description Frank Büttner 2016-12-08 12:21:26 UTC
Description of problem:
Using the jdownloader under wayland mode, java crash with an coredump.
Using the X11 mode, all works.

Version-Release number of selected component (if applicable):
java-1.8.0-openjdk-1.8.0.111-4.b16.fc25.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. start gnome in wayland mdoe
2. start jdownloader

Actual results:
Java crash with an coredump

Expected results:
Working application

Additional info:
Using the X11 mode on gnome, all works.

Comment 1 Frank Büttner 2016-12-08 17:34:32 UTC
An core dump is available for debug, but abrt fails to generate an backtrace with:
--- Running report_uReport ---
('report_uReport' completed successfully)

--- Running analyze_CCpp ---
Ok to upload core dump? (It may contain sensitive data). If your answer is 'No', a stack trace will be generated locally. (It may download a huge amount of data). 'NO'
Analyzing coredump 'coredump'
Missing build id: /tmp/tmp/jna/jna8711063590888228607.tmp
All debuginfo files are available
Generating backtrace
Backtrace is generated and saved, 198595 bytes
Looking for similar problems in bugzilla

Comment 2 Severin Gehwolf 2016-12-09 13:22:52 UTC
Dies in my F25 VM with:

Gnome Desktop detected
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fc58c2c1be9, pid=2486, tid=0x00007fc568424700
#
# JRE version: OpenJDK Runtime Environment (8.0_111-b16) (build 1.8.0_111-b16)
# Java VM: OpenJDK 64-Bit Server VM (25.111-b16 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libawt_xawt.so+0x40be9]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/sgehwolf/hs_err_pid2486.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

I'm attaching the hs_err file.

Comment 3 Severin Gehwolf 2016-12-09 13:24:04 UTC
Created attachment 1229961 [details]
hotspot error log file.

Comment 4 Zhengyu 2016-12-09 18:32:59 UTC
This bug is NOT JDK version specific, but general problem. It is due to incompatible nature of Wayland vs. X11.

Due to security concern, Wayland does not allow application to access screen back buffer. A simple test case (to be attached) can easily reproduce the crash.

However, not been able to access screen back buffer should NOT result a crash.

Comment 5 Zhengyu 2016-12-09 18:33:50 UTC
Created attachment 1230115 [details]
Simple reproducer

Comment 6 Zhengyu 2016-12-09 18:52:26 UTC
Created attachment 1230116 [details]
Patch to avoid the crash

This patch avoids the crash, but results incompatible behavior. I will file an upstream bug for long term solution.

Comment 7 Zhengyu 2016-12-09 19:06:37 UTC
Upstream bug: https://bugs.openjdk.java.net/browse/JDK-8171000

Comment 8 Zhengyu 2016-12-16 12:37:27 UTC
Besides java.awt.Robot.createScreenCapture(), following Robot APIs also fail:

* java.awt.Robot.getPixelColore() -> crash
* java.awt.Robot.keyPress()/KeyRelease() -> no effect
* java.awt.Robot.mouseMove()/mousePress()/mouseRelease()/mouseWheel() -> no effect

Comment 9 Zhengyu 2016-12-16 12:59:19 UTC
Attached patch also avoids java.awt.Robot.getPixelColor() crash. However, the returned color value seems random.

Comment 10 Christian Stadelmann 2016-12-22 10:20:51 UTC
When I ran into this crash I could not take a backtrace from java running JDownloader, because of a bug in GDB: https://sourceware.org/bugzilla/show_bug.cgi?id=16577 . This probably also is the reason why abrt can't create a backtrace.

Comment 11 Severin Gehwolf 2017-01-10 11:13:17 UTC
*** Bug 1411651 has been marked as a duplicate of this bug. ***

Comment 12 Severin Gehwolf 2017-01-18 17:27:03 UTC
*** Bug 1413585 has been marked as a duplicate of this bug. ***

Comment 13 Severin Gehwolf 2017-01-20 09:09:31 UTC
*** Bug 1415089 has been marked as a duplicate of this bug. ***

Comment 14 William Ferguson 2017-09-20 04:07:30 UTC
This is not Wayland specific. We are running RedHat 6.6 on Gnome and get exactly the same SIGSEV.

Can I suggest that the title be changed. As shown in the Reproducer, this is about Robot#createScreenCapture not jdownloader.

Comment 15 William Ferguson 2017-09-20 04:16:15 UTC
Sorry FVWM not Gnome.

Comment 16 Fedora End Of Life 2017-11-16 19:03:08 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 17 Severin Gehwolf 2017-11-17 08:15:44 UTC
I believe this issue is still present in some form in F27. Re-targetting.

Comment 18 Andrew John Hughes 2018-03-14 15:22:24 UTC
Fix has been pushed to OpenJDK 11:

http://hg.openjdk.java.net/jdk/jdk/rev/05077701f689

Comment 19 Mark Harfouche 2018-04-16 21:37:29 UTC
Is there any chance this is going to get backported to OpenJDK 8?

Comment 20 Mark Harfouche 2018-04-17 20:34:58 UTC
I'm getting a related bug

```
#
# An unexpected error has occurred (11)
#
Stack:
/opt/Xilinx/Vivado/2018.1/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x923332) [0x7f7ad1abc332]
/opt/Xilinx/Vivado/2018.1/tps/lnx64/jre/lib/amd64/server/libjvm.so(JVM_handle_linux_signal+0x12b) [0x7f7ad1ac0f4b]
/opt/Xilinx/Vivado/2018.1/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x91ac88) [0x7f7ad1ab3c88]
/lib64/libc.so.6(+0x346e0) [0x7f7b169746e0]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.162-6.b12.fc27.x86_64/jre/lib/amd64/libawt_xawt.so(+0x415f9) [0x7f7ab25185f9]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.162-6.b12.fc27.x86_64/jre/lib/amd64/libawt_xawt.so(+0x41c6f) [0x7f7ab2518c6f]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.162-6.b12.fc27.x86_64/jre/lib/amd64/libawt_xawt.so(Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl+0x1ea) [0x7f7ab251025a]
[0x7f7ac1950bfb]
```

I tried backporting and rebuilding the RPM. Unfortunately I've only ever encountered this uses (free) but proprietary software.

I know how to reproduce it using that software, but somebody has to be willing to dedicate 30GB of harddrive space to install Vivado....

Comment 21 Andrew John Hughes 2018-06-07 02:04:22 UTC
Backport: https://icedtea.classpath.org/hg/icedtea8-forest/jdk/rev/b77308735540