Page 1 of 1

Segmentation fault; Dedicated server question

Posted: 2013-05-09T14:31:06-07:00
by Don
Hello everyone,

First I would like to say thank you for imagemagick! Thank you!

I have recently come across some issues in regards to imagemagick on my hosting provider. When doing a simple convert for the -spread, -blur, and -paint operators using the PHP exec() function, according to my host provider, this is causing a segmentation fault.

The imagemagick version my host has installed is:

Version: ImageMagick 6.7.9-10 2012-10-05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

My home version is:

Version: ImageMagick 6.8.0-7 2013-02-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL

I immediately thought I was getting that error because of the older version of imagemagick they have installed or perhaps their configuration of imagemagick is not done correctly. In the past few days I have been in communication with them and basically this is what they have to say about the issue:

Begin email <---"Hello,

There's several possibilities that could be related. It's also possible that it's a combination of these factors.

First, in addition to the version difference, your version of convert is compiled with OpenCL. Our version is OpenMP. This is probably because our servers have more cores.

Second, and this is likely to be a more significant contributer, is that in our shared environment, we do limit the amount of memory a process is allowed to consume on a per-user basis. In reviewing our error logs, I see this:

00:04:21.801087 mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory)

This would indicate that your process is running out of available memory. (of course, that's not an indication that the box is out of memory, but rather that we are protecting the box by not allowing any user to consume an unfair amount of memory).

The first issue (the version of ImageMagick) could be fixed, but we have a rigorous vetting process before we allow upgraded versions onto our production servers, because of the number of customers potentially impacted if faulty upgrade gets released. I have requested the upgrade, but I can't promise if or when it would happen; In addition, I'm not certain that it would resolve your issue. You may be able to test this by reverting your version to the version that we have; if that version fails on your computer as well, then we would have the proof that there's a useful fix in the new version.

In the mean time, our Dedicated product, because you are no longer sharing resources, does not have the same constraints, and indeed, you can install the version of ImageMargick that you require. Our VPS product should similarly be able to accomodate that, although we aren't quite ready to launch that yet. Dedicated servers are available, and because we are technically still in beta, we are offer a 50% discount from the first month; this may be something that you are interested in, especially if you are doing a lot of image processing." ---> end email

Many of the other convert commands/operators work perfectly, even some of Fred's wonderful scripts, but for some reason the simple -spread, -blur, and -paint operations are causing a segfault on the server. So it leaves me with the only option is to move over to a dedicated server.

Since basically I am in the looking for a dedicated server, I was wondering if you can tell me what kind of server environment(specifications) is ideal in having imagemagick process images and handle users without any problems?

I really appreciate the input. Thank you!

Re: Segmentation fault; Dedicated server question

Posted: 2013-05-09T16:53:21-07:00
by magick
Set the ImageMagick policy, policy.xml, for example,

Code: Select all

<policymap>
  <policy domain="resource" name="temporary-path" value="/tmp"/> 
  <policy domain="resource" name="memory" value="256MiB"/> 
  <policy domain="resource" name="map" value="512MiB"/> 
  <policy domain="resource" name="area" value="128MB"/> 
  <policy domain="resource" name="disk" value="1GiB"/> 
  <policy domain="resource" name="file" value="768"/> 
  <policy domain="resource" name="thread" value="2"/>
  <policy domain="resource" name="throttle" value="0"/> 
  <policy domain="resource" name="time" value="120"/> 
  <policy domain="system" name="precision" value="6"/> 
  <policy domain="cache" name="shared-secret" value="My voice is my passport.  Verify me."/>
</policymap>
Adjust the arguments to fit your environment. See http://www.imagemagick.org/script/architecture.php for a discussion of the pixel cache and how these policies are useful in preventing DOS. The latest releases of ImageMagick are always recommended to take advantage of any bug fixes or performance improvements.

We don't have a specific hardware recommendation. Our servers supports JQMagick and ImageMagick Studio (see footer of http://www.imagemagick.org) and we never have resource problems. It has 8GB of memory and 4 Xeon x5660 cores.