Bug 24621 - libX11/src/xcb_io.c:553: _XRead: Assertion `dpy->xcb->reply_data != ((void *)0)' failed.
Summary: libX11/src/xcb_io.c:553: _XRead: Assertion `dpy->xcb->reply_data != ((void *)...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Input/Core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: dmx-bugs
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 07:17 UTC by Jon Turney
Modified: 2009-10-23 13:52 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to resolve an inconsistency between libX11 and Xserver over GetModifierMapping (1.12 KB, patch)
2009-10-19 15:20 UTC, Jon Turney
no flags Details | Splinter Review

Description Jon Turney 2009-10-19 07:17:10 UTC
Xdmx with a 1.6.5 Xserver backend seems to work fine. Xdmx with a 1.7.0 or git master backend seems to sometimes fail with the assert: libX11/src/xcb_io.c:553: _XRead: Assertion `dpy->xcb->reply_data != ((void *)0)' failed.


Xdmx: /opt/jhbuild/git/xorg/lib/libX11/src/xcb_io.c:553: _XRead: Assertion `dpy->xcb->reply_data != ((void *)0)' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7aa36c0 (LWP 6425)]
0xffffe424 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb7ae8660 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb7ae9e98 in *__GI_abort () at abort.c:88
#3  0xb7ae16ce in *__GI___assert_fail (assertion=0xb802c61c "dpy->xcb->reply_data != ((void *)0)",
    file=0xb802c5ec "/opt/jhbuild/git/xorg/lib/libX11/src/xcb_io.c", line=553,
    function=0xb802c771 "_XRead") at assert.c:78
#4  0xb7fbe44b in _XRead (dpy=0x9845918, data=0x999cad8 "\030忷\030忷▒▒\231\t▒▒\231\td", size=960)
    at /opt/jhbuild/git/xorg/lib/libX11/src/xcb_io.c:553
#5  0xb7fbe488 in _XReadPad (dpy=0x9845918, data=0x999cad8 "\030忷\030忷▒▒\231\t▒▒\231\td",
    size=0) at /opt/jhbuild/git/xorg/lib/libX11/src/xcb_io.c:568
#6  0xb7fa52e1 in XGetModifierMapping (dpy=0x9845918)
    at /opt/jhbuild/git/xorg/lib/libX11/src/ModMap.c:55
#7  0x08192216 in dmxCommonSaveState (private=0x98c2100)
    at /opt/jhbuild/git/xorg/xserver/hw/dmx/input/dmxcommon.c:609
#8  0x0819326d in dmxCommonKbdGetInfo (pDev=0x98c2380, info=0xbf9adfd0)
    at /opt/jhbuild/git/xorg/xserver/hw/dmx/input/dmxcommon.c:265
#9  0x0818e89e in dmxBackendKbdGetInfo (pDev=0x98c2380, info=0xbf9adfd0)
    at /opt/jhbuild/git/xorg/xserver/hw/dmx/input/dmxbackend.c:597
#10 0x08187337 in dmxDeviceOnOff (pDevice=0x98c2380, what=0)
    at /opt/jhbuild/git/xorg/xserver/hw/dmx/input/dmxinputinit.c:447
#11 0x08127309 in ActivateDevice (dev=0x98c2380, sendevent=1 '\001')
    at /opt/jhbuild/git/xorg/xserver/dix/devices.c:470
#12 0x08127cca in InitAndStartDevices () at /opt/jhbuild/git/xorg/xserver/dix/devices.c:640
#13 0x0811d565 in main (argc=4, argv=0xbf9aeb44, envp=Cannot access memory at address 0x1921
)
    at /opt/jhbuild/git/xorg/xserver/dix/main.c:258
(gdb) frame 4
#4  0xb7fbe44b in _XRead (dpy=0x9845918, data=0x999cad8 "\030忷\030忷▒▒\231\t▒▒\231\td", size=960)
    at /opt/jhbuild/git/xorg/lib/libX11/src/xcb_io.c:553
553             assert(dpy->xcb->reply_data != NULL);
(gdb) p *dpy->xcb
$1 = {connection = 0x9846bb8, pending_requests = 0x99a5a40, pending_requests_tail = 0x99a5a40,
  next_event = 0x0, real_bufmax = 0x9850418 "", reply_data = 0x0, reply_length = 52,
  reply_consumed = 52, last_flushed = 221, event_owner = XlibOwnsEventQueue, next_xid = 8388703,
  event_notify = 0x9845600, event_waiter = 0}
(gdb)
Comment 1 Jon Turney 2009-10-19 07:25:37 UTC
This assert is also reported in an unclear fashion at http://lists.freedesktop.org/archives/xorg/2009-October/047728.html
Comment 2 Jon Turney 2009-10-19 08:21:44 UTC
This seems to be caused by a failure of the call to generate_modkeymap() in ProcGetModifierMapping() in the backend X server.

Presumably that causes badly-formed X11 protocol to be emitted, which causes the assert.
Comment 3 Yaakov Selkowitz 2009-10-19 14:12:48 UTC
(16:05:20) JKac3BEq: I've seen that error too
(16:05:36) JKac3BEq: I get that when I try to write to the back end display directly, instead of writing to the Xdmx display

So I tried starting the backend X servers with -noreset, didn't help.

I should add that this doesn't seem to occur with Xdmx ... -input dummy.
Comment 4 Jon Turney 2009-10-19 15:20:29 UTC
Created attachment 30574 [details] [review]
Patch to resolve an inconsistency between libX11 and Xserver over GetModifierMapping

It seems the assert occurs because there is an inconsistency between the Xserver and libX11 about whether the GetModifierMapping protocol request can return an error or not.  libX11 assumes it doesn't, but the Xserver can.

Attached patch resolves this inconsistency in favour of libX11, as that's what the protocol docs seem to say.

ProcXGetDeviceModifierMapping() also uses generate_modkeymap() in a similar way, needs auditing if this it has a similar problem.

As to why my modmap is disappearing exposing this problem, that's another issue...
Comment 5 Yaakov Selkowitz 2009-10-19 15:38:37 UTC
(In reply to comment #4)
> Created an attachment (id=30574) [details]
> Patch to resolve an inconsistency between libX11 and Xserver over
> GetModifierMapping

If so, the variable 'ret' is no longer needed in this function.
Comment 6 Jon Turney 2009-10-23 13:52:27 UTC
Applied as commit 909df9beb3ddd02632f36ae682537280a6a8e5b4


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.