Bug 13952

Summary: X crashes after hibertnating, unplugging monitor and going back from hibernate
Product: xorg Reporter: Mikhail Gusarov <dottedmag>
Component: Driver/intelAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED DUPLICATE QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: dank, shrek
Version: 7.2 (2007.02)   
Hardware: x86 (IA32)   
OS: All   
URL: https://bugzilla.altlinux.org/show_bug.cgi?id=13203
Whiteboard:
i915 platform: i915 features:

Description Mikhail Gusarov 2008-01-07 02:27:00 UTC
X server crashes after hibertnating, unplugging monitor and going back from hibernate.

Steps to reproduce:
1. Start X with external monitor on laptop
2. Hibernate
3. Detach monitor
4. Wake up system
5. xrandr --output LVDS --dpi 96x96 --output VGA --off
6. Run something using core fonts (orginal submission used 'einstein' program)

HW: dell inspiron 700m, i855G
SW: xorg-x11-server-1.4 xorg-x11-dri-intel-7.0.1 xorg-x11-drv-intel-2.1.1

...
(==) Log file: "/var/log/Xorg.0.log", Time: Tue Oct 23 08:59:52 2007
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module "ddc" already built-in
(II) Module "i2c" already built-in
(EE) intel(0): detecting sil164
(EE) intel(0): Unable to read from DVOI2C_E Slave 112.
(II) Module "ramdac" already built-in

Backtrace:
0: X(xf86SigHandler+0x7e) [0x80d57fe]
1: [0xa7f74420]
2: X(VidModeGetNumOfModes+0x40) [0x80d1f30]
3: /usr/lib/X11/modules/extensions//libextmod.so [0xa7bbeafa]
4: /usr/lib/X11/modules/extensions//libextmod.so [0xa7bc132a]
5: X [0x814f8fe]
6: X(Dispatch+0x2ca) [0x8087e3a]
7: X(main+0x495) [0x806c8a5]
8: /lib/libc.so.6(__libc_start_main+0xdc) [0xa7d4d05c]
9: X(FontFileCompleteXLFD+0x245) [0x806bc01]

Fatal server error:
Caught signal 11.  Server aborting

xinit:  connection to X server lost.
Comment 1 Dan Kegel 2008-11-03 20:25:32 UTC
I can reproduce this with the default X server on Ubuntu 8.10,
but only on Intel graphics, not on nvidia.  Probably need
to change category to Drivers/Intel?

Xorg.log says:

X.Org X Server 1.5.2
Release Date: 10 October 2008
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-19-server i686 Ubuntu
Current Operating System: Linux slave1 2.6.27-7-generic #1 SMP Thu Oct 30 04:18:38 UTC 2008 i686
Build Date: 24 October 2008  08:00:16AM
xorg-server 2:1.5.2-2ubuntu3 (buildd@rothera.buildd)
...
(--) PCI:*(0@0:2:0) Intel Corporation 82G33/G31 Express Integrated Graphics Controller rev 16, Mem @ 0xe1200000/0, 0xd0000000/0, 0xe1000000/0, I/O @ 0x0000e000/0
...
(II) intel(0): DDCModeFromDetailedTiming: 1024x768 Warning: We only handle seperate sync.

Backtrace:
0: /usr/X11R6/bin/X(xf86SigHandler+0x79) [0x80c3009]
1: [0xb7fea400]
2: /usr/X11R6/bin/X(VidModeGetNumOfModes+0x40) [0x80c8270]
3: /usr/lib/xorg/modules/extensions//libextmod.so [0xb7b340d0]
4: /usr/X11R6/bin/X(Dispatch+0x34f) [0x808c89f]
5: /usr/X11R6/bin/X(main+0x47d) [0x8071d1d]
6: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb7bf1685]
7: /usr/X11R6/bin/X [0x8071101]
Saw signal 11.  Server aborting.

Sadly, even with every xorg*-dbg package installed, I see no
line numbers in the stack dump.

Annoyingly, because only two copies of Xorg.log are kept in /var/log,
one has to tail -f it or use startx or the like to capture
the error.

Here's how to reproduce:
run any Wine conformance test that creates a window
while the monitor is unplugged.  For instance,
 $ cd dlls/user32/tests
 $ rm static.ok
 $ make static.ok
will run fine with the cable plugged in, and crash with it unplugged.

Wine's log file, generated with WINEDEBUG=+all,+synchronous make test,
seems to indicate the crash is generated very quickly after
wine starts using X, probably while it is getting a list of
video modes:

0018:trace:module:load_dll Found L"C:\\windows\\system32\\winex11.drv" for L"winex11.drv" at 0x60a70000, count=2
...
0018:trace:x11settings:X11DRV_Settings_SetHandlers Resolution settings now handled by: NoRes
0018:trace:x11settings:X11DRV_Settings_SetHandlers Initialized new display modes array
0018:trace:x11settings:X11DRV_Settings_AddOneMode initialized mode 0: 1400x1050x32 @60 Hz (NoRes)
make: *** wait: No child processes.  Schluss.
make: *** Warte auf noch nicht beendete Prozesse...
make: *** wait: No child processes.  Schluss.
0009: *killed* exit_code=0
0008: *process killed*
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"^M
      after 86 requests (85 known processed) with 0 events remaining.^M

(A related annoyance is that running any such Wine test
wine the monitor is plugged in generates about fifty
lines in the Xorg log file, like this:

(II) intel(0): DDCModeFromDetailedTiming: 1024x768 Warning: We only handle seperate sync.
(II) intel(0): Using hsync ranges from config file
(II) intel(0): Using vrefresh ranges from config file
(II) intel(0): Printing DDC gathered Modelines:
(II) intel(0): Modeline "1280x1024"x0.0  108.00  1280 1328 1440 1688  1024 1025 1028 1066 +hsync +vsync (64.0 kHz)
(II) intel(0): Modeline "1024x768"x0.0   78.75  1024 1040 1136 1312  768 769 772 800 -hsync -vsync (60.0 kHz)
...

This leads to logfiles hundreds of megabytes long.  The log
needs to be less verbose.)

I'm happy to test... I'll also report this to the ubuntu-x list,
and if anything comes of it, I'll link to it here.
Comment 2 Dan Kegel 2008-11-04 04:48:35 UTC
Bryce pointed me to https://wiki.ubuntu.com/X/Backtracing
so now I have a good backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7af56b0 (LWP 6959)]
VidModeGetFirstModeline (scrnIndex=0, mode=0xbf9935a8, dotClock=0xbf9935a4)
    at ../../../../hw/xfree86/common/xf86VidMode.c:229
229     ../../../../hw/xfree86/common/xf86VidMode.c: No such file or directory.
        in ../../../../hw/xfree86/common/xf86VidMode.c
(gdb) bt
#0  VidModeGetFirstModeline (scrnIndex=0, mode=0xbf9935a8, dotClock=0xbf9935a4)
    at ../../../../hw/xfree86/common/xf86VidMode.c:229
#1  0x080c8270 in VidModeGetNumOfModes (scrnIndex=0)
    at ../../../../hw/xfree86/common/xf86VidMode.c:451
#2  0xb7adc0d0 in ProcXF86VidModeGetAllModeLines (client=0x8410da8)
    at ../../../../../hw/xfree86/dixmods/extmod/xf86vmode.c:534
#3  0x0808c89f in Dispatch () at ../../dix/dispatch.c:454
#4  0x08071d1d in main (argc=10, argv=0xbf9937b4, envp=0x0)
    at ../../dix/main.c:441

The crash seems to be because xf86Screens[scrnIndex]->modes is NULL,
and VidModeGetFirstModeline simply falls over dereferencing it:

218  VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
219  {
220	ScrnInfoPtr pScrn;
221	VidModePtr pVidMode;
222	
223	if (!VidModeAvailable(scrnIndex))
224	  return FALSE;
225	
226	pScrn = xf86Screens[scrnIndex];
227	pVidMode = VMPTR(pScrn->pScreen);
228	pVidMode->First = pScrn->modes;
229	pVidMode->Next = pVidMode->First->next;

Hmm, VidModeAvailable does
135	pVidMode = VMPTR(pScrn->pScreen);
136	if (pVidMode)
137	  return TRUE;
Should it also check pVidMode->First ?

A search for this in bugzilla finds bug 17431, perhaps these are the same bug.
Comment 3 Gordon Jin 2008-12-04 19:40:06 UTC

*** This bug has been marked as a duplicate of bug 17431 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.