WeasyPrint: WeasyPrint 0.42 gets stuck

We are calling WeasyPrint via pandoc. With 0.42 and a certain input, the command never completes, but does not throw an error, causing builds to timeout.

Downgrading from weasyprint 0.42 to 0.41 solves the issue: https://github.com/greenelab/scihub-manuscript/commit/5cb1245ca3e68c425b1364317e2496c17e20353c produced a passing build.

The issue doesn’t happen for all inputs (pandoc manuscripts). See for example, this passing build with WeasyPrint 0.42.

The command that fails is:

pandoc \
  --from=markdown \
  --to=html5 \
  --pdf-engine=weasyprint \
  --pdf-engine-opt=--presentational-hints \
  --filter=pandoc-fignos \
  --filter=pandoc-eqnos \
  --filter=pandoc-tablenos \
  --bibliography=$BIBLIOGRAPHY_PATH \
  --csl=$CSL_PATH \
  --metadata link-citations=true \
  --webtex=https://latex.codecogs.com/svg.latex? \
  --css=webpage/github-pandoc.css \
  --output=output/manuscript.pdf \
  $INPUT_PATH

Any ideas on what the problem could be or how to better diagnose the issue?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve checked the tricky part of the new breaking line algorithm that causes these bugs (see #301 and #528). I’ve added some comments to help us in the future and corrected a couple of problems. I’ve also added a test to make sure this case won’t happen again.

I really appreciate the time you take to report the issues and provide examples. If you find other crashes, please report them as well, I’ll do my best to fix them as soon as possible!

Hi,

I am running into some issues with WeasyPrint getting stuck when creating PDFs from certain HTML files. I have now managed to (kind of) narrow down when this error occurs. My coding skills are insufficient to go into the WeasyPrint code to find out why this is happening; I hope this is helpful anyway. The files are attached.

wp-table-demonstration.zip

Basically, it’s quite strange: On my system, the file “triangulate-error.html” will cause WeasyPrint to go into a kind of infinite loop when printing a page that contains a table; while “triangulate-noerror.html” will create a PDF within a matter of seconds. The only difference between them is in one additional “strong” tag in one of the cells. No error is logged by WeasyPrint. Interestingly, one other way to make the issue disappear is to change the font in the CSS to “Times New Roman”. (I have also tried Georgia, Palatino, and my preferred font Iowan Old Style.)

My system is macOS Sierra 10.12.6 (16G1212), Python 3.6.4, WeasyPrint version 0.42.1. I hope someone is able to reproduce this problem. If there is any way I can help, let me know.

EDIT: I have looked in-depth at another article that was causing the problem. I now have the suspicion that it is probably something to do with using tags that affect formatting such as “strong” and “em” within brackets, both round and square.