Bug 54950

Summary: Poppler hangs when printing a PDF
Product: cairo Reporter: Germán Poo-Caamaño <gpoo+bfdo>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.12.6   
Hardware: Other   
OS: All   
See Also: https://launchpad.net/bugs/780869
https://bugzilla.gnome.org/show_bug.cgi?id=649987
Whiteboard:
i915 platform: i915 features:
Attachments: PDF test case
backtrace
backtrace full (cairo master cf07bd866dc3fd )
cairo test code

Description Germán Poo-Caamaño 2012-09-15 06:14:08 UTC
Created attachment 67194 [details]
PDF test case

This bug was reported in Ubuntu Launchpad against Evince, then to GNOME Bugzilla, but it seems the problem is in poppler.

Steps to reproduce it:
- Open the file with poppler-glib-demo (I tried with master b72c02d1)
- Render the first page
- Print to a file (PDF).
Comment 1 Germán Poo-Caamaño 2012-09-15 06:15:54 UTC
Created attachment 67195 [details]
backtrace

This is the backtrace I got after trying to print.
Comment 2 Adrian Johnson 2012-11-03 00:54:24 UTC
Works for me with poppler master and cairo 1.12.6 using the command:

pdftocairo -pdf bug54950.pdf out.pdf

According to your stack trace you are using cairo 1.10.2. Looks like a bug that has been fixed in cairo. Please re-open if you can reproduce the bug with cairo master.
Comment 3 Germán Poo-Caamaño 2012-11-03 18:31:10 UTC
(In reply to comment #2)
> Works for me with poppler master and cairo 1.12.6 using the command:
> 
> pdftocairo -pdf bug54950.pdf out.pdf

This command also works with previous versions of cairo.

> According to your stack trace you are using cairo 1.10.2. Looks like a bug
> that has been fixed in cairo. Please re-open if you can reproduce the bug
> with cairo master.

I can reproduce it with cairo master from Nov 3 (cf07bd866dc).
Comment 4 Germán Poo-Caamaño 2012-11-03 18:32:59 UTC
Created attachment 69496 [details]
backtrace full (cairo master cf07bd866dc3fd )

Updated backtrace with cairo master cf07bd866dc3fd
Comment 5 Adrian Johnson 2012-11-04 00:07:24 UTC
Looks a cairo deadlock bug when destroying fonts.
Comment 6 Adrian Johnson 2012-11-04 00:13:14 UTC
Created attachment 69507 [details] [review]
cairo test code

Attached is a minimal cairo program to reproduce the bug. It needs to be run with the PDF file attached to this bug.

The macros at the top allow any combination of PNG PS, or PDF output. It works fine for any single output or for PS and PDF output. But when PNG and at least one of PS/PDF is included it hangs during the PS/PDF output somewhere in scaled_font_destroy.

I'm not sure why this particular PDF file triggers the bug but it does contain over 100 fonts which may have something to do with it.
Comment 7 Chris Wilson 2013-01-08 15:06:36 UTC
commit 4d4bf8fddff49d349e03282ffa827f6f4659e3fe
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 8 14:56:07 2013 +0000

    scaled-font: Free the cached glyphs from the font before taking the global lock
    
    In the case of a recording surface we may recurse into the global glyph
    cache so we need to be careful and stage the ordering of how we free the
    glyphs. So first we finish any information and surfaces from the scaled
    font glyph cache (and so triggering recursion into other scaled fonts)
    and then take the global cache and remove our pages.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54950
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.