Bug 1567633

Summary: Assertion in cairo 1.15.12
Product: [Fedora] Fedora Reporter: Tom Hughes <tom>
Component: cairoAssignee: Benjamin Otte <otte>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ajax, alexl, awilliam, john.j5live, jsmith.fedora, kevin, klember, mclasen, otte, rhughes, rstrode, sandmann
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: RejectedFreezeException
Fixed In Version: cairo-1.15.12-2.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-27 04:11:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test case none

Description Tom Hughes 2018-04-15 16:28:18 UTC
Description of problem:

Since the recent update from cairo 1.15.10 to 1.15.12 mapnik's tests are failing with an assertion in cairo:

cairo-ft-font.c:576: _cairo_ft_unscaled_font_create_internal: Assertion `unscaled->base.hash_entry.hash == key.base.hash_entry.hash' failed.

Version-Release number of selected component (if applicable):

1.15.12-1.fc29

How reproducible:

Every time.

Steps to Reproduce:
1. Build mapnik in koji
2. Watch tests fail

Comment 1 Tom Hughes 2018-04-15 23:31:54 UTC
A fuller backtrace of the assertion:

#0  0x00007ffff33fbf7b in raise () from /lib64/libc.so.6
#1  0x00007ffff33e65c1 in abort () from /lib64/libc.so.6
#2  0x00007ffff33e6491 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007ffff33f46e2 in __assert_fail () from /lib64/libc.so.6
#4  0x00007ffff6976928 in _cairo_ft_unscaled_font_create_internal (
    from_face=from_face@entry=1, filename=filename@entry=0x0, id=id@entry=0, 
    font_face=<optimized out>, out=out@entry=0x7fffffffb448)
    at cairo-ft-font.c:576
#5  0x00007ffff6977881 in _cairo_ft_unscaled_font_create_from_face (
    out=0x7fffffffb448, face=<optimized out>) at cairo-ft-font.c:3707
#6  cairo_ft_font_face_create_for_ft_face (face=<optimized out>, load_flags=2)
    at cairo-ft-font.c:3707
#7  0x00007ffff7709df7 in mapnik::cairo_face::cairo_face(std::shared_ptr<mapnik::font_library> const&, std::shared_ptr<mapnik::font_face> const&) ()
   from /lib64/libmapnik.so.3.0
#8  0x00007ffff770a11e in mapnik::cairo_face_manager::get_face(std::shared_ptr<mapnik::font_face>) () from /lib64/libmapnik.so.3.0
#9  0x00007ffff770a2e2 in mapnik::cairo_context::set_font_face(mapnik::cairo_face_manager&, std::shared_ptr<mapnik::font_face>) () from /lib64/libmapnik.so.3.0
#10 0x00007ffff770a543 in mapnik::cairo_context::add_text(mapnik::glyph_positions const&, mapnik::cairo_face_manager&, mapnik::composite_mode_e, mapnik::composite_mode_e, double) () from /lib64/libmapnik.so.3.0
#11 0x00007ffff770f30e in mapnik::cairo_renderer<std::shared_ptr<_cairo> >::process(mapnik::text_symbolizer const&, mapnik::feature_impl&, mapnik::proj_transform const&) () from /lib64/libmapnik.so.3.0

Comment 2 Tom Hughes 2018-04-15 23:48:54 UTC
I think this stems from https://cgit.freedesktop.org/cairo/commit/?id=42f07ef9037ea871dc0e58200437aab9c702ad6d which changed the key generation for the unscaled face to use face->face_index as the id.

In _cairo_ft_unscaled_font_create_internal the hash for the original is created using id (zero in this case) and then the new unscaled face is created but using a different id to generate the hash. It was always different but previously was zero which did match and is now the face index which doesn't.

Comment 3 Tom Hughes 2018-04-17 18:21:24 UTC
Created attachment 1423211 [details]
Test case

So this happens when a font has multiple faces in the same file and you try and create a cairo face from a freetype face with a non-zero index.

A minimal test case is attached.

Comment 4 Kalev Lember 2018-04-21 22:16:41 UTC
Thanks, I backported the upstream fix to cairo-1.15.12-2.fc28 now.

Comment 5 Fedora Update System 2018-04-21 22:17:33 UTC
cairo-1.15.12-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-f6b5861387

Comment 6 Fedora Update System 2018-04-23 22:51:32 UTC
cairo-1.15.12-2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-f6b5861387

Comment 7 Fedora Blocker Bugs Application 2018-04-24 13:54:59 UTC
Proposed as a Freeze Exception for 28-final by Fedora user pwalter using the blocker tracking app because:

 Would be nice to include this fix as a FE as it fixes a common crash. Shouldn't have any side effects as it's just a tiny patch fixing the crash.

Comment 8 Jared Smith 2018-04-24 18:59:54 UTC
+1 as a FE from me.

Comment 9 Kevin Fenzi 2018-04-24 19:03:04 UTC
+1 FE I guess... do we know if anything except mapnik hits it?

Comment 10 Adam Williamson 2018-04-24 19:35:27 UTC
I don't see any indication of that either here or in the upstream bug (https://bugs.freedesktop.org/show_bug.cgi?id=105746 )...I mean, from the description it sounds like other things *could* hit it, but I don't see any definite reports that they *do* yet.

Comment 11 Adam Williamson 2018-04-24 19:53:37 UTC
<kalev-afk> adamw: I haven't heard of anything else besides mapnik hitting it
<kalev-afk> adamw: seems fine to me to leave it for a post-GA update

Given that, I'm -1.

Comment 12 Kevin Fenzi 2018-04-24 20:03:40 UTC
Yeah, I will change to -1 if it's just mapnik. We can fix that in a update.

Comment 13 Kevin Fenzi 2018-04-24 20:19:54 UTC
Yeah, I will change to -1 if it's just mapnik. We can fix that in a update.

Comment 14 Adam Williamson 2018-04-24 22:42:28 UTC
Gonna call this rejected for now, just to clean up the list.

Comment 15 Fedora Update System 2018-04-27 04:11:07 UTC
cairo-1.15.12-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.