php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57835 Imagick extension causes Apache to reset connection
Submitted: 2007-09-12 13:31 UTC Modified: 2007-09-14 09:23 UTC
From: neil at scare dot me dot uk Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.2.1 OS: Debian testing x86
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: neil at scare dot me dot uk
New email:
PHP Version: OS:

 

 [2007-09-12 13:31 UTC] neil at scare dot me dot uk
Description:
------------
Sometimes Apache resets the connection with the browser when a PDF document is loaded into Imagick. I haven't found a way to reproduce it every time, but reloading the script below a few times usually triggers it. This seems to occur with any PDF, but not with other filetypes.

Versions 2.0.0RC2 and CVS exhibit the problem.

Apache 2.2.4 with PHP 5.2.3

Reproduce code:
---------------
<?php
header('Content-type: image/jpeg');
$img = new Imagick;
$img->setResolution(288, 288);
$img->readImage('map.pdf');
$img->setImageFormat('JPEG');
$img->resampleImage(144, 144, imagick::FILTER_LANCZOS, 1);
print $img;


Expected result:
----------------
map.pdf should be loaded and the first page output as a JPEG after being resized.

Actual result:
--------------
Apache resets the connection with the browser but the process doesn't die. gs continues to process the PDF document and the script performs the conversion to JPEG, but obviously nothing can be sent to the browser. Nothing is recorded in any error logs.

Any further attempts to load a PDF with Imagick immediately trigger the bug. Restarting Apache fixes it temporarily.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-12 13:41 UTC] mkoppanen@php.net
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit http://pecl.php.net/support/ as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

I am not sure if this an Imagick bug. Converting PDF to JPEG can be pretty resource intensive and that might be the reason why Apache resets the connection.

You can use $img->readImage('map.pdf[0]'); to read just the first page.
 [2007-09-14 09:23 UTC] neil at scare dot me dot uk
I did some further testing and it seems to have been a bug in Apache 2.2.4 from Debian testing. I haven't been able to reproduce it on Apache 2.2.6.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 10:01:28 2024 UTC