Re: Xorg segfaults on XOpenDisplay multi thread

2008-12-30 Thread Matan Drori
Hi Daniel,
we are currently using Xorg 6.9(cannot change the version)
we also have several pipes, meaning we need to open several displays.
and of course we need to do it in threads.

Do you have any suggestions?

Daniel Stone wrote:
 On Mon, Dec 29, 2008 at 11:06:27AM +0200, Matan Drori wrote:
   
 I'm calling multiple XOpenDisplay calls from different threads.
 

 This is not really possible with Xlib.  Should be okay with XCB, though.

 Cheers,
 Daniel
   

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: bump: Xorg segfaults on XOpenDisplay multi thread

2008-12-30 Thread Bill Crawford
On Sunday 28 December 2008 08:56:50 Matan Drori wrote:
 Bump, adding some backtraces:
 Dump 1:
 #0  _X11TransWritev (ciptr=0x0, buf=0x21b96720, size=1) at
 ../../lib/xtrans/Xtrans.c:911
 #1  0x20093910 in _XSendClientPrefix (dpy=value optimized out,
 client=value optimized out, auth_proto=0x0, auth_string=0x0,
 prefix=0x21b96784) at ConnDis.c:572
 #2  0x200c4640 in XOpenDisplay (display=value optimized out)
 at OpenDis.c:295
 #3  0x40001580 in ThreadMain_OpenDisplayAndStartTest (num=0x1)
 at ../../thread.cpp:37
 #4  0x2027d5d0 in start_thread () from /lib/libpthread.so.0
 #5  0x207cb730 in __clone2 () from /lib/libc.so.6.1
 Dump 2:
 #0  0x2070f350 in malloc_consolidate () from /lib/libc.so.6.1
 #1  0x20714830 in _int_malloc () from /lib/libc.so.6.1
 #2  0x20716ef0 in calloc () from /lib/libc.so.6.1
 #3  0x200c4530 in XOpenDisplay (display=value optimized out)
 at OpenDis.c:262
 #4  0x40001580 in ThreadMain_OpenDisplayAndStartTest (num=0x2)
 at ../../thread.cpp:37
 #5  0x2027d050 in start_thread () from /lib/libpthread.so.0
 #6  0x207cb730 in __clone2 () from /lib/libc.so.6.1

 i explored this topic for quite a while, when i debug it i see memory
 corruptions every time it crashes. memory corruptions doesn't always occur
 at the same place which makes it even harder and more confusing.

Well, the ciptr=0x0 looks suspicious, to say the least. But it smells like you 
have an issue with thread safety somewhere underneath libX11, like in the C 
library. Did you link against libpthread?
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: bump: Xorg segfaults on XOpenDisplay multi thread

2008-12-30 Thread Matan Drori
hi bill
i went to that direction, i linked to libpthread didn't do any good
i tried working with ptmalloc3 instead of the ptmalloc2 thats in glibc,
and it didn't do any good so i went back one layer up to the Xorg
I did that since i couldn't re produce bug by linking malloc debuggers
to my programs(tried dmalloc and Electric fence)
but it seems like it doesn't reproduce just cause the malloc debugger
has different timings.

i agree that the  ciptr=0x0 is very suspicious, after looking further
into it (Xorg debug without -o2) i saw that it goes a bit up.
looks like there is no connection with the server, or maybe its just a
memory override somewhere along the way.
couldn't quite pin point the spot.
and it couldn't be that the dpy-trans_conn got a wrong value when
connected because if so the it would have returned null after the call
for _X11TransConnectDisplay
*OpenDis.c:154*
 if ((dpy-trans_conn = _X11TransConnectDisplay (
 display_name, fullname, idisplay,
 iscreen, conn_auth_name,
 conn_auth_namelen,
conn_auth_data,
 conn_auth_datalen)) == NULL) {
Xfree ((char *) dpy);
return(NULL);
}
(dpy-trans_conn is what we later send as the ciptr...)
I also added a print for all the data sent in this function and it
always prints the correct information, even when sagfaults.

if you look at the second segfualt its in a very simple line
*OpenDis.c:262*
if ((dpy-bufptr = dpy-buffer = Xcalloc(1, conn_buf_size)) == NULL)
just a simple calloc(buffer size correct, always), and that really
puzzled me... but i guess its just something corrupted in the memory.

any thing else you think might lead this?

Bill Crawford wrote:
 On Sunday 28 December 2008 08:56:50 Matan Drori wrote:
   
 Bump, adding some backtraces:
 Dump 1:
 #0  _X11TransWritev (ciptr=0x0, buf=0x21b96720, size=1) at
 ../../lib/xtrans/Xtrans.c:911
 #1  0x20093910 in _XSendClientPrefix (dpy=value optimized out,
 client=value optimized out, auth_proto=0x0, auth_string=0x0,
 prefix=0x21b96784) at ConnDis.c:572
 #2  0x200c4640 in XOpenDisplay (display=value optimized out)
 at OpenDis.c:295
 #3  0x40001580 in ThreadMain_OpenDisplayAndStartTest (num=0x1)
 at ../../thread.cpp:37
 #4  0x2027d5d0 in start_thread () from /lib/libpthread.so.0
 #5  0x207cb730 in __clone2 () from /lib/libc.so.6.1
 Dump 2:
 #0  0x2070f350 in malloc_consolidate () from /lib/libc.so.6.1
 #1  0x20714830 in _int_malloc () from /lib/libc.so.6.1
 #2  0x20716ef0 in calloc () from /lib/libc.so.6.1
 #3  0x200c4530 in XOpenDisplay (display=value optimized out)
 at OpenDis.c:262
 #4  0x40001580 in ThreadMain_OpenDisplayAndStartTest (num=0x2)
 at ../../thread.cpp:37
 #5  0x2027d050 in start_thread () from /lib/libpthread.so.0
 #6  0x207cb730 in __clone2 () from /lib/libc.so.6.1

 i explored this topic for quite a while, when i debug it i see memory
 corruptions every time it crashes. memory corruptions doesn't always occur
 at the same place which makes it even harder and more confusing.
 

 Well, the ciptr=0x0 looks suspicious, to say the least. But it smells like 
 you 
 have an issue with thread safety somewhere underneath libX11, like in the C 
 library. Did you link against libpthread?
   

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Xorg segfaults on XOpenDisplay multi thread

2008-12-29 Thread Eirik Byrkjeflot Anonsen
Matan Drori ma...@graphtech.co.il writes:

 Machine spec:
 IA64
 /SUSE Linux Enterprise Server/ 10 sp 2
 xorg x11 6.9.0-50.58

 I have a very simple test program that opens 4 threads and does
 XOpenDisplay(opening 4 separate display objects).

 i keep getting segfaults on different places in the function
 seems like some kind timing problem that causes memory corruption.

You have called XInitThreads?  (See man XInitThreads)

(I don't know how thread-safe xorg is.  I have the impression that
there are some issues.  But without XInitThreads(), it isn't supposed
to be thread-safe).

eirik
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Xorg segfaults on XOpenDisplay multi thread

2008-12-29 Thread Matan Drori
I'm Using XInitThreads(), and have no use for the other thread functions
since im not sharing a display(XLockDisplay and XUnlockDisplay that
recive a display object).

I'm calling multiple XOpenDisplay calls from different threads.
It looks like a deeper issue since I'm not sharing the display object
itself.
if needed i can post my test program here(very small) even tough  i
couldn't re produce it on my openSuse 11.1 machine, only on the IA64
sles 10 sp 2 machine.

Eirik Byrkjeflot Anonsen wrote:
 Matan Drori ma...@graphtech.co.il writes:

   
 Machine spec:
 IA64
 /SUSE Linux Enterprise Server/ 10 sp 2
 xorg x11 6.9.0-50.58

 I have a very simple test program that opens 4 threads and does
 XOpenDisplay(opening 4 separate display objects).

 i keep getting segfaults on different places in the function
 seems like some kind timing problem that causes memory corruption.
 

 You have called XInitThreads?  (See man XInitThreads)

 (I don't know how thread-safe xorg is.  I have the impression that
 there are some issues.  But without XInitThreads(), it isn't supposed
 to be thread-safe).

 eirik
 ___
 xorg mailing list
 xorg@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/xorg
   

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Xorg segfaults on XOpenDisplay multi thread

2008-12-29 Thread Daniel Stone
On Mon, Dec 29, 2008 at 11:06:27AM +0200, Matan Drori wrote:
 I'm calling multiple XOpenDisplay calls from different threads.

This is not really possible with Xlib.  Should be okay with XCB, though.

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg