Bug 1502788 - gdkscreen-x11: Don't try to calculate a refresh rate when the XRRModeInfo doesn't have one
Summary: gdkscreen-x11: Don't try to calculate a refresh rate when the XRRModeInfo doe...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gtk3
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Debarshi Ray
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 1565096 1571842
TreeView+ depends on / blocked
 
Reported: 2017-10-16 16:57 UTC by Piyush Bhoot
Modified: 2018-10-30 10:20 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1565096 (view as bug list)
Environment:
Last Closed: 2018-10-30 10:19:48 UTC
Target Upstream Version:


Attachments (Terms of Use)
coredump (478.78 KB, application/x-gzip)
2017-10-16 16:57 UTC, Piyush Bhoot
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNOME Bugzilla 768999 0 None None None 2019-04-02 16:12:21 UTC
GNOME Bugzilla 775546 0 None None None 2019-04-02 16:12:21 UTC
Red Hat Product Errata RHSA-2018:3140 0 None None None 2018-10-30 10:20:48 UTC

Description Piyush Bhoot 2017-10-16 16:57:40 UTC
Created attachment 1339392 [details]
coredump

Description of problem:

gnome-terminal crashes with a "signal 8, Arithmetic exception" when DISPLAY points to a Windows Exceed X-server

$ gdb /usr/bin/gnome-terminal core.1408

[New LWP 1408]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `gnome-terminal'.
Program terminated with signal 8, Arithmetic exception.
#0  0x00007f12c7c3a23c in init_randr13 (changed=<synthetic pointer>, screen=0x8c0030) at gdkscreen-x11.c:640
640                       refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal *xmode->vTotal);
(gdb) p xmode->hTotal
$1 = 0
(gdb) p xmode->vTotal
$2 = 0
(gdb) p xmode->dotClock
$3 = 0
(gdb) bt
#0  0x00007f12c7c3a23c in init_multihead (changed=<synthetic pointer>, screen=0x8c0030 [GdkX11Screen]) at gdkscreen-x11.c:640
#1  0x00007f12c7c3a23c in init_multihead (screen=screen@entry=0x8c0030 [GdkX11Screen]) at gdkscreen-x11.c:841
#2  0x00007f12c7c3a908 in _gdk_x11_screen_new (display=display@entry=0x8bb0f0 [GdkX11Display], screen_number=0) at gdkscreen-x11.c:906
#3  0x00007f12c7c2a278 in _gdk_x11_display_open (display_name=<optimized out>) at gdkdisplay-x11.c:1416
#4  0x00007f12c7bfe389 in gdk_display_manager_open_display (manager=<optimized out>, name=0x0) at gdkdisplaymanager.c:472
#5  0x00007f12c80bc366 in post_parse_hook (context=<optimized out>, group=<optimized out>, data=0x88cad0, error=0x7ffcc191bf68)
    at gtkmain.c:801
#6  0x00007f12c634d798 in g_option_context_parse (context=context@entry=0x8a6f60, argc=argc@entry=0x7ffcc191bf5c, argv=argv@entry=0x7ffcc191bf50, error=error@entry=0x7ffcc191bf68) at goption.c:2165
#7  0x0000000000409108 in terminal_options_parse (working_directory=working_directory@entry=0x88c590 "/home/localusr", startup_id=startup_id@entry=0x0, argcp=argcp@entry=0x7ffcc191bf5c, argvp=argvp@entry=0x7ffcc191bf50, error=error@entry=0x7ffcc191bf68) at terminal-options.c:868
#8  0x0000000000405f89 in main (argc=1, argv=0x7ffcc191c1b8) at terminal.c:375


Version-Release number of selected component (if applicable):
gnome-terminal-3.22.1-2.el7.x86_64   
gtk3-3.22.10-4.el7.x86_64   

How reproducible:
Randomly

Steps to Reproduce:
1.Launch gnome-terminal through Exceed Xserver


Actual results:
Crashes with Signal 8

Expected results:
No crash

Additional info:
This problem seems to have appeared from RHEL 7.4 (no problem with 7.3) and I'm able only to reproduce it with Exceed X-server in Windows.

Comment 2 Debarshi Ray 2017-10-17 17:41:39 UTC
Have you been able to similarly crash any other gtk3 application? Say gedit, nautilus, evolution, etc..

Comment 4 Ajinkya Patil 2018-02-20 06:11:12 UTC
Hello Debarshi,

I have a similar crash but not sure if it's same 

~~~
Core was generated by `/usr/libexec/gnome-session-check-accelerated'.
Program terminated with signal 8, Arithmetic exception.
#0  0x00007fb8f59bf23c in init_randr13 (changed=<synthetic pointer>, screen=0xe00020) at gdkscreen-x11.c:640
640	                  refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal *xmode->vTotal);
(gdb) bt
#0  0x00007fb8f59bf23c in init_randr13 (changed=<synthetic pointer>, screen=0xe00020) at gdkscreen-x11.c:640
#1  init_multihead (screen=screen@entry=0xe00020) at gdkscreen-x11.c:841
#2  0x00007fb8f59bf908 in _gdk_x11_screen_new (display=display@entry=0xdf90e0, screen_number=0) at gdkscreen-x11.c:906
#3  0x00007fb8f59af278 in _gdk_x11_display_open (display_name=<optimized out>) at gdkdisplay-x11.c:1416
#4  0x00007fb8f5983389 in gdk_display_manager_open_display (manager=<optimized out>, name=0x0) at gdkdisplaymanager.c:472
#5  0x00007fb8f5e410da in gtk_init_check (argc=argc@entry=0x0, argv=argv@entry=0x0) at gtkmain.c:1093
#6  0x00007fb8f5e41109 in gtk_init (argc=argc@entry=0x0, argv=argv@entry=0x0) at gtkmain.c:1150
#7  0x00000000004012a0 in main (argc=<optimized out>, argv=<optimized out>) at gnome-session-check-accelerated.c:140
(gdb) list
635	          for (j = 0; j < resources->nmode; j++)
636	            {
637	              XRRModeInfo *xmode = &resources->modes[j];
638	              if (xmode->id == crtc->mode)
639	                {
640	                  refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal *xmode->vTotal);
641	                  break;
642	                }
643	            }
644	
(gdb) p xmode
$1 = (XRRModeInfo *) 0xdfd140
(gdb) p *xmode
$2 = {id = 63, width = 1920, height = 1058, dotClock = 0, hSyncStart = 0, hSyncEnd = 0, hTotal = 0, hSkew = 0, vSyncStart = 0, vSyncEnd = 0, vTotal = 0, name = 0xdfd190 "1920x1058", 
  nameLength = 9, modeFlags = 0}

~~~

in this customer's case, he is not able to access the gnome via xdmcp.

Please take a look at this and let me know if they are the same or different,

Thanks,

Comment 5 Divya 2018-02-21 05:50:38 UTC
I guess XRRModeInfo needs to be replaced with GVariant implementation as in below patch for reference: 

https://mail.gnome.org/archives/commits-list/2013-July/msg07229.html

and IMHO bug needs to be marked against gtk3. Please check and confirm.

Comment 7 Debarshi Ray 2018-03-08 14:10:48 UTC
(In reply to Ajinkya Patil from comment #4)
> Hello Debarshi,
> 
> I have a similar crash but not sure if it's same 

Yes, it's the same crash.

Comment 8 Debarshi Ray 2018-03-08 14:25:56 UTC
(In reply to Divya from comment #5)
> I guess XRRModeInfo needs to be replaced with GVariant implementation as in
> below patch for reference: 
> 
> https://mail.gnome.org/archives/commits-list/2013-July/msg07229.html

That's slightly different. It's about abstracting X and Wayland display configuration code, which is used by Settings to set up displays, behind the same public API. Since XRandR (including XRRModeInfo) is an X API that's not present in Wayland, GnomeRR (which is part of libgnome-desktop) either needs to have separate code paths for X and Wayland or it can use something else (eg., Mutter) that already takes care of the abstraction. That patch does the latter.

This bug is about GTK+'s X backend, and since GTK+ already has different code paths for each of it's display backends, we need to fix the particular backend.

This particular bug is relatively very simple. It's just that the Windows Exceed X server doesn't advertise a refresh rate value and GTK+ isn't prepared for that.

Comment 9 Debarshi Ray 2018-03-08 14:42:07 UTC
(In reply to Piyush Bhoot from comment #0)
> This problem seems to have appeared from RHEL 7.4 (no problem with 7.3) and
> I'm able only to reproduce it with Exceed X-server in Windows.

Yes, that's because gtk3 was rebased from 3.14.x to 3.22.x in RHEL 7.4, and the display output code had some significant changes. The absence of a refresh rate from the X server isn't the end of the world - GTK+ simply falls back to 60 Hz. However, there is one place which is missing some conditional guards.

Comment 19 Debarshi Ray 2018-04-11 14:19:59 UTC
Bug 1566101 is related.

Comment 25 Michael Boisvert 2018-08-29 10:10:28 UTC
Switching to verified based on comment 23.

Comment 27 errata-xmlrpc 2018-10-30 10:19:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3140


Note You need to log in before you can comment on or make changes to this bug.