https://bugs.freedesktop.org/show_bug.cgi?id=82290
Priority: medium Bug ID: 82290 Assignee: libreoffice-bugs@lists.freedesktop.org Summary: EPS rendering using GS may cause pipe writing deadlock Severity: major Classification: Unclassified OS: Linux (All) Reporter: hiroto.kagot...@gmail.com Hardware: All Status: UNCONFIRMED Version: 4.2.5.2 release Component: filters and storage Product: LibreOffice If I have pstoedit, there is no problem with handling EPS files. Without pstoedit, EPS is rendered as BMP using GS in RenderAsBMPThroughHelper(). The input/output to/from GS are transferred using pipes. RenderAsBMPThroughHelper() first writes the EPS file content to a pipe pIn, then closes the pipe, and then reads BMP result from another pipe pOut. With this sequence, GS may start to produce the BMP result as soon as it reads a "showpage" operator from stdin, and this causes a deadlock between LO writing to a pipe and GS writing to another pipe. On FreeBSD, this situation frequently happens because write(2) >= 8KB to pipes always blocks until the whole pipe buffer content is consumed by read(2). On Linux, this situation rarely happens because write(2) to pipes returns immediately if the size is less than the buffer size. However, large EPS using a "showpage" operator and including a large bogus trailer can cause this deadlock. Attached EPS and ODP are example files that cause the deadlock. How-to-repeat: Make sure pstoedit is NOT installed and GS is properly installed. On FreeBSD (9.3R or 10.0R) or Linux (Fedora 20), open the attached ODP file, or insert the attached EPS file to any LO document. Fix: There are several solutions to fix this deadlock. 1. Do not use pipes for both direction. Like in RenderAsEMF(), use a temporary file for BMP result. 2. Do not use blocking write(2)/read(2). Make them non-blocking, and use select(2) to choose the next operation. 3. Perform write(2) and read(2) concurrently. Create a new thread and perform write(2) in it. Attached patch is for the 3rd solution. -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs