Bug 2246

Summary: cairo and XFree86 4.2.1 across SSH
Product: cairo Reporter: Amaury Jacquot <sxpert>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED WORKSFORME QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: high CC: billy.biggs, jwatt, pere, roland.mainz
Version: 0.9.3   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Output from xdpyinfo

Description Amaury Jacquot 2005-01-09 12:45:10 UTC
here's the crashlog when attempting to run mapeditor on an old X (4.2.1 or
something)

%
LD_LIBRARY_PATH=/skole/tjener/home0/pere/src/openstreetmapsvn/mapeditor-debug/lib
gdb ./mapeditor
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) break exit
Function "exit" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (exit) pending.
(gdb) break main
Breakpoint 2 at 0x8051b49: file main.c, line 205.
(gdb) break _exit
Function "_exit" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 3 (_exit) pending.
(gdb) run --sync
Starting program:
/skole/tjener/home0/pere/src/openstreetmapsvn/mapeditor-debug/src/mapeditor/src/mapeditor
--sync
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 29737)]
Breakpoint 4 at 0x407a8a86
Pending breakpoint "exit" resolved
Breakpoint 5 at 0x40824dbc
Pending breakpoint "_exit" resolved
[Switching to Thread 16384 (LWP 29737)]

Breakpoint 2, main (argc=2, argv=0xbffffc44) at main.c:205
205       gtk_init(&argc,&argv);
(gdb) c
Continuing.
scroll adjustment requested 0x80b04a0 0x80b30d8
update_adjustment 0x80b04a0
update_adjustment 0x80b30d8
me_transform_resize_surface: ( 0 , 0 ) - 0
143 x 51 -- 0 x 0 | ( 0 , 0 ) - ( 0 , 0 )
me_transform_resize_surface: ( 0 , 0 ) - 0
1006 x 601 -- 0 x 0 | ( 0 , 0 ) - ( 0 , 0 )
loading tracks from file requested
signal_data 0x8053528 | file_selector 0x810d158 | mapeditor 0x8093cd0
reading file
/skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/src/track-2005-01.gpx
7311066695147732796 0.000000
3682536253565067075422435951902192467225307869722202525040006097212316836447517968520594386058424162606064416593637135001329063355506216888883281667156619720944443432186333051155615966862202497233760203219646624323826633481912320.000000
1125867336810118856572928.000000 1953833533
not a navsys version 0 file or unable to open file
reading file
/skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/src/track-2005-01.gpx
16
Not an NGPSD version 1 tracklog
not a navsys version 1 file or unable to open file
reading file
/skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/src/track-2005-01.gpx
begin of XML document
10
end of XML document
Generating Squares
Squares done
GPX file successfully loaded

(mapeditor:29737): Gdk-CRITICAL **: file gdkvisual-x11.c: line 645
(gdk_x11_visual_get_xvisual): assertion `visual != NULL' failed
me_layer_track 0x8144d30 setting track 0x8133ef8 (8 tracks)
me_transform_set_center: ( 59.9123 , 10.6126 ) - 0
1006 x 601 -- 0 x 0 | ( 10.6126 , 59.9123 ) - ( 10.6126 , 59.9123 )
me_transform_set_zoom_factor: ( 59.9123 , 10.6126 ) - 0.000343312
1006 x 601 -- 0.345372 x 0.206331 | ( 10.4399 , 60.0154 ) - ( 10.7853 , 59.8091 )
update_adjustment 0x80b04a0
update_adjustment 0x80b30d8
The program 'mapeditor' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 34259 error_code 8 request_code 72 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Breakpoint 4, 0x407a8a86 in exit () from /lib/libc.so.6
(gdb) bt
#0  0x407a8a86 in exit () from /lib/libc.so.6
#1  0x40346931 in _gdk_windowing_exit () from /usr/lib/libgdk-x11-2.0.so.0
#2  0x40568614 in _XError () from /usr/X11R6/lib/libX11.so.6
#3  0x40564c1a in _XGetAsyncData () from /usr/X11R6/lib/libX11.so.6
#4  0x40566257 in _XSend () from /usr/X11R6/lib/libX11.so.6
#5  0x4055b674 in _XReverse_Bytes () from /usr/X11R6/lib/libX11.so.6
#6  0x4055bb31 in _XReverse_Bytes () from /usr/X11R6/lib/libX11.so.6
#7  0x4055bdbb in XPutImage () from /usr/X11R6/lib/libX11.so.6
#8  0x404e7b64 in _cairo_xlib_surface_set_image (abstract_surface=0x813ebf0,
    image=0x1) at cairo_xlib_surface.c:296
#9  0x404e0318 in _cairo_surface_set_image (surface=0x23a, image=0x23a)
    at cairo_surface.c:163
#10 0x404e0521 in _cairo_surface_composite (operator=CAIRO_OPERATOR_OVER,
    src=0x8145030, mask=0x0, dst=0x813ebf0, src_x=0, src_y=0, mask_x=0,
    mask_y=0, dst_x=0, dst_y=0, width=1006, height=601) at cairo_surface.c:271
#11 0x404da4ef in _cairo_gstate_show_surface (gstate=0x81379d8,
    surface=0x8145030, width=1006, height=601) at cairo_gstate.c:2099
#12 0x404d3717 in cairo_show_surface (cr=0x8093c28, surface=0x23a, width=570,
    height=570) at cairo.c:1034
#13 0x0804f1d7 in me_layer_draw (layer=0x8144d30, cr=0x8093c28, src_x=0,
    src_y=0, dst_x=0, dst_y=0, width=1006, height=601) at me-layer.c:242
#14 0x080503f2 in map_editor_expose (widget=0x1, event=0x23a)
    at map-editor.c:324
#15 0x401410d4 in _gtk_marshal_BOOLEAN__BOXED ()
   from /usr/lib/libgtk-x11-2.0.so.0
#16 0x40413fb7 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#17 0x40413c20 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#18 0x40427655 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#19 0x404269be in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#20 0x40426ee4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#21 0x4023ff67 in gtk_widget_send_expose () from /usr/lib/libgtk-x11-2.0.so.0
#22 0x4013e39d in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#23 0x40329f13 in gdk_window_clear_area_e () from /usr/lib/libgdk-x11-2.0.so.0
#24 0x4032a01a in gdk_window_process_all_updates ()
   from /usr/lib/libgdk-x11-2.0.so.0
#25 0x4032a075 in gdk_window_process_all_updates ()
   from /usr/lib/libgdk-x11-2.0.so.0
#26 0x40474033 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#27 0x40470c02 in g_main_depth () from /usr/lib/libglib-2.0.so.0
#28 0x40471cf8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#29 0x40472030 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#30 0x40472673 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#31 0x4013dc83 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#32 0x08051b65 in main (argc=1, argv=0xbffffc44) at main.c:209
(gdb)
Comment 1 Owen Taylor 2005-01-17 10:45:50 UTC
This might well be a bug in the application ... or in GtkCairo; somebody
is likely not passing the right visual into GTK+ or to cairo.

xpdyinfo might be interesting. BadMatch on PutImage
should only occur for mismatched depths. Does the target display have
multiple available visuals?
Comment 2 Petter Reinholdtsen 2005-01-17 11:02:18 UTC
Created attachment 1693 [details]
Output from xdpyinfo

Here is the output from xdpyinfo in the problematic display.  I
access it across an SSH forwarding, in case that is relevant.
Comment 3 Owen Taylor 2005-01-17 12:41:57 UTC
xdpyinfo information looks normal, not a problem.

Looking again at the error log - 

(mapeditor:29737): Gdk-CRITICAL **: file gdkvisual-x11.c: line 645

is the first thing to track down and fix before investigating further.
(A gtkcairo or app problem, cairo couldn't generate that warning.)

You can get a backtrace at that point by running the program with
--g-fatal-warnings.
Comment 4 Owen Taylor 2005-01-17 13:01:51 UTC
There are obviously bad problems in cairo_xlib_surface.c for handling
anything other than 24bpp destination surfaces. It isn't going to work
for 16bpp windows. Don't see how that's relevant for that display,
however.

Comment 5 Petter Reinholdtsen 2005-01-17 13:11:09 UTC
This is the backtrace when running with --g-fatal-warnings
(and --sync, which I believe I remember should do positive things).
I hope this will bring you closer to the target.

pere@minerva:~/src/openstreetmapsvn/mapeditor-debug/src/mapeditor$ gdb ./src/mapeditor
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run --g-fatal-warnings --sync
Starting program: /skole/tjener/home0/pere/src/openstreetmapsvn/mapeditor-debug/src/mapeditor/src/mapeditor --g-fatal-warnings --sync
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 14884)]
Could not open /proc/14884/status
(gdb) q
The program is running.  Exit anyway? (y or n) y
pere@minerva:~/src/openstreetmapsvn/mapeditor-debug/src/mapeditor$ gdb ./src/mapeditor
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run --g-fatal-warnings --sync
Starting program: /skole/tjener/home0/pere/src/openstreetmapsvn/mapeditor-debug/src/mapeditor/src/mapeditor --g-fatal-warnings --sync
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 14888)]
scroll adjustment requested 0x80b0290 0x80b2960
update_adjustment 0x80b0290
update_adjustment 0x80b2960
me_transform_resize_surface: ( 0 , 0 ) - 0
143 x 51 -- 0 x 0 | ( 0 , 0 ) - ( 0 , 0 )
me_transform_resize_surface: ( 0 , 0 ) - 0
1006 x 601 -- 0 x 0 | ( 0 , 0 ) - ( 0 , 0 )
loading tracks from file requested
signal_data 0x8053528 | file_selector 0x810b948 | mapeditor 0x8093cf8
reading file /skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/data/fns-2004-12-10.gpx
7311066695147732796 0.000000 3682536253565067075422435951902192467225307869722202525040006097212316836447517968520594386058424162606064416593637135001329063355506216888883281667156619720944443432186333051155615966862202497233760203219646624323826633481912320.000000 1125867336810118856572928.000000 1397301821
not a navsys version 0 file or unable to open file
reading file /skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/data/fns-2004-12-10.gpx
16
Not an NGPSD version 1 tracklog
not a navsys version 1 file or unable to open file
reading file /skole/tjener/home0/pere/src/openstreetmapsvn/openstreetmap/data/fns-2004-12-10.gpx
begin of XML document
2
end of XML document
Generating Squares
Squares done
GPX file successfully loaded

Gdk-CRITICAL **: file gdkvisual-x11.c: line 645 (gdk_x11_visual_get_xvisual): assertion `visual != NULL' failed
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 16384 (LWP 14888)]
0x4079c741 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4079c741 in kill () from /lib/libc.so.6
#1  0x40717771 in pthread_kill () from /lib/libpthread.so.0
#2  0x40717a7b in raise () from /lib/libpthread.so.0
#3  0x4079c4d4 in raise () from /lib/libc.so.6
#4  0x4079da08 in abort () from /lib/libc.so.6
#5  0x40479c37 in g_logv () from /usr/lib/libglib-2.0.so.0
#6  0x40479c74 in g_log () from /usr/lib/libglib-2.0.so.0
#7  0x4034bfad in gdk_x11_visual_get_xvisual ()
   from /usr/lib/libgdk-x11-2.0.so.0
#8  0x0804ee16 in me_layer_resize_surface (layer=0x404ca738, width=1006,
    height=601) at me-layer.c:143
#9  0x08050506 in load_filename (file_selector=0x80c0300, data=0x8151d38)
    at map-editor.c:378
#10 0x40428121 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#11 0x40413c20 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#12 0x40427c28 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#13 0x40426be7 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#14 0x40426ee4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#15 0x400832a5 in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0
#16 0x400842bb in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#17 0x40428121 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#18 0x40413fb7 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#19 0x40413c20 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#20 0x40427451 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#21 0x40426be7 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#22 0x40426ee4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#23 0x400831f5 in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0
#24 0x4008413b in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#25 0x401410d4 in _gtk_marshal_BOOLEAN__BOXED ()
   from /usr/lib/libgtk-x11-2.0.so.0
#26 0x40413fb7 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#27 0x40413c20 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#28 0x40427655 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#29 0x404269be in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#30 0x40426ee4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#31 0x4023ff67 in gtk_widget_send_expose () from /usr/lib/libgtk-x11-2.0.so.0
#32 0x4013f672 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#33 0x4013e3c6 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#34 0x4033c1a5 in _gdk_events_queue () from /usr/lib/libgdk-x11-2.0.so.0
#35 0x40470c02 in g_main_depth () from /usr/lib/libglib-2.0.so.0
#36 0x40471cf8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#37 0x40472030 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#38 0x40472673 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#39 0x4013dc83 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#40 0x08051b65 in main (argc=1, argv=0xbffffc84) at main.c:209
(gdb)
Comment 6 Kristian Høgsberg 2005-06-03 10:35:16 UTC
Could this be the new ssh behaviour of using the SECURITY extension with the -X
option?  Recently, ssh changed the -X option to use the SECURITY extension, if
you want the old behaviour, you should use -Y.
Comment 7 Petter Reinholdtsen 2005-06-03 10:39:09 UTC
Yes, it could be that.  I used ssh from a debian/woody system
into a debian/sid system, and the sid system had a new sshd.

Why should cairo care about the X security status, btw?
Comment 8 Billy Biggs 2005-07-27 14:37:32 UTC
Cairo doesn't care, but using -X instead of -Y now means that certain X
functions which seem benign will suddenly fail.  This affects a lot of X apps. 
In general it seems that app authors are recommending "use -Y" rather than
trying to figure out which calls fail on what X servers and see what can be done
to work around them.
Comment 9 Owen Taylor 2005-08-18 16:02:52 UTC
Really not clear at all what is going on here. What needs to be done here
is to try this with current GTK+ and Cairo (using GTK+-2.8 native integration
with Cairo rather than GtkCairo), and if it still crashes, under a 
debugger:

 - Break on gdk_x_error
 - run the program with --sync 
 - Provide a backtrace. 

Having debug symbols for GTK+ would be great.
Comment 10 Carl Worth 2005-08-22 17:14:50 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.
Comment 11 Petter Reinholdtsen 2005-08-24 10:36:30 UTC
Just for the record, I am no longer able to test this issue.  The woody machine
I used when I discovered this problem is reinstalled with sarge.
Comment 12 Owen Taylor 2005-08-24 10:43:00 UTC
Clsoing as WORKSFORME since it seems unlikely that we'll get more information
here.

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.