[cairo] New per-scaled_font mutex to fix locking bugs

Jan Slupski jslupski at juljas.net
Wed Feb 7 10:06:33 PST 2007



Hi again,

With the latest test patches (cairo_ft_unscaled_font_lock_face.patch,
cairo_ft_unscaled_mutex.patch) I'm still getting three assertions
(and ocassional core dumps - actually one, cannot reproduce).

These are:

threads: cairo-font.c:115: cairo_font_face_destroy: Assertion `font_face->ref_count > 0' failed.

#0  0x0000003a3bc301b5 in raise () from /lib64/libc.so.6
#1  0x0000003a3bc31b20 in abort () from /lib64/libc.so.6
#2  0x0000003a3bc298c6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002aeb14942adc in cairo_font_face_destroy () from <...>/lib/libcairo.so.2
#4  0x00002aeb1494ff6b in _cairo_scaled_font_fini () from <...>/lib/libcairo.so.2
#5  0x00002aeb1494fab9 in _cairo_scaled_font_map_destroy () from <...>/lib/libcairo.so.2
#6  0x00002aeb1494302f in _cairo_font_reset_static_data () from <...>/lib/libcairo.so.2
#7  0x00002aeb14942625 in cairo_debug_reset_static_data () from <...>/lib/libcairo.so.2

lt-pthread-show-text: cairo-font.c:115: cairo_font_face_destroy: Assertion `font_face->ref_count > 0' failed.

#0  0x0000003bbd0301b5 in raise () from /lib64/libc.so.6
#1  0x0000003bbd031b20 in abort () from /lib64/libc.so.6
#2  0x0000003bbd0298c6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002aaaaaabb0d3 in *INT_cairo_font_face_destroy (font_face=0x60a390) at cairo-font.c:115
#4  0x00002aaaaaac4d72 in _cairo_scaled_font_fini (scaled_font=0x648960) at cairo-scaled-font.c:416
#5  0x00002aaaaaac52f9 in _cairo_scaled_font_map_destroy () at cairo-scaled-font.c:248
#6  0x00002aaaaaabaf99 in _cairo_font_reset_static_data () at cairo-font.c:472
#7  0x00002aaaaaabaabe in cairo_debug_reset_static_data () at cairo-debug.c:66
#8  0x0000000000402a52 in main (argc=<value optimized out>, argv=<value optimized out>) at pthread-show-text.c:108

threads: cairo-hash.c:196: _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.

#0  0x0000003a3bc301b5 in raise () from /lib64/libc.so.6
#1  0x0000003a3bc31b20 in abort () from /lib64/libc.so.6
#2  0x0000003a3bc298c6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002b3ec6b33fa3 in _cairo_hash_table_destroy () from <...>/lib/libcairo.so.2
#4  0x00002b3ec6b31047 in _cairo_font_reset_static_data () from <...>/lib/libcairo.so.2
#5  0x00002b3ec6b30625 in cairo_debug_reset_static_data () from <...>/lib/libcairo.so.2

lt-pthread-show-text: cairo-hash.c:196: _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.

#0  0x0000003bbd0301b5 in raise () from /lib64/libc.so.6
#1  0x0000003bbd031b20 in abort () from /lib64/libc.so.6
#2  0x0000003bbd0298c6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002aaaaaabdb67 in _cairo_hash_table_destroy (hash_table=0x609b00) at cairo-hash.c:196
#4  0x00002aaaaaabafb1 in _cairo_font_reset_static_data () at cairo-font.c:475
#5  0x00002aaaaaabaabe in cairo_debug_reset_static_data () at cairo-debug.c:66
#6  0x0000000000402a52 in main (argc=<value optimized out>, argv=<value optimized out>) at pthread-show-text.c:108

lt-pthread-show-text: cairo-ft-font.c:568: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->lock > 0' failed.

#0  0x0000003bbd0301b5 in raise () from /lib64/libc.so.6
#1  0x0000003bbd031b20 in abort () from /lib64/libc.so.6
#2  0x0000003bbd0298c6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002aaaaaad19eb in _cairo_ft_unscaled_font_unlock_face (unscaled=<value optimized out>) at cairo-ft-font.c:568
#4  0x00002aaaaaad237c in *INT_cairo_ft_scaled_font_unlock_face (abstract_font=0x2aaaac012550) at cairo-ft-font.c:2439
#5  0x00002aaaaaad372d in _cairo_ft_scaled_glyph_init (abstract_font=0x2aaaac012550, scaled_glyph=0x2aaaac012bc0, info=0)
     at cairo-ft-font.c:1970
#6  0x00002aaaaaac54b1 in _cairo_scaled_glyph_lookup (scaled_font=0x2aaaac012550, index=71, info=<value optimized out>,
     scaled_glyph_ret=0x42803008) at cairo-scaled-font.c:1393
#7  0x00002aaaaaac5e35 in _cairo_scaled_font_text_to_glyphs (scaled_font=0x2aaaac012550, x=95, y=1, utf8=<value optimized out>,
     glyphs=0x428030e0, num_glyphs=dwarf2_read_address: Corrupted DWARF expression.
) at cairo-scaled-font.c:832
#8  0x00002aaaaaabc182 in _cairo_gstate_text_to_glyphs (gstate=0x614900, utf8=0x40646d "Hello world.\n", x=50, y=1,
     glyphs=0x428030e0, num_glyphs=0x428030ec) at cairo-gstate.c:1422
#9  0x00002aaaaaab6b42 in cairo_show_text (cr=0x61b260, utf8=0x40646d "Hello world.\n") at cairo.c:2658
#10 0x0000000000402b2d in start (closure=<value optimized out>) at pthread-show-text.c:67
#11 0x0000003bbdc06305 in start_thread () from /lib64/libpthread.so.0
#12 0x0000003bbd0cd50d in clone () from /lib64/libc.so.6


In pthread-show-text.c I was able to reproduce these when added:

   cairo_select_font_face (cr, "Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);

just before cairo_select_font_face(...) call, and running with many (ie
200) threads. (Running on multi-core/mulri-cpu system is probaly essential.)

Jan



    _  _  _  _  _____________________________________________
    | |_| |\ |  S L U P S K I             jslupski at juljas.net
  |_| | | | \|                             http://juljas.net/


More information about the cairo mailing list