Resource limits are not working

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

Clearly the environment variables are not being set for your process. If so, your temporary files would show up in /home/magick. With PHP you can use putenv() to set environment variables or you can include them on the command line (e.g. -limit area 1mb) or edit them in configure.xml (see http://www.imagemagick.org/script/resources.php). From the command line you can set the temporary path, for example, as
  • convert -define registry:temporary-path=/data/tmp image.jpg image.png

signsrus

Re: Resource limits are not working

Post by signsrus »

The env var is correct for user nobody which is what Apache is running as. MAGICK_TMPDIR is set but the output still is using /tmp which should now be /home/magick.

signsrus

Re: Resource limits are not working

Post by signsrus »

I tried the limit attribute and that doesn't do anything different.

I will try the configure.xml although I can not find one anywhere with locate.

......are you sure this is supposed to work. Nothing I do here is working.

Thank you,

~Shawn

User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

The important thing is it works as advertised for us :-).

signsrus

Re: Resource limits are not working

Post by signsrus »

/usr/local/lib/ImageMagick-6.5.0/config/configure.xml:

Code: Select all

...
  <configure name="MAGICK_TMPDIR" value="/home/magick"/>
  <configure name="MAGICK_MEMORY_LIMIT" value="32mb"/>
  <configure name="MAGICK_MAP_LIMIT" value="64mb"/>
  <configure name="MAGICK_AREA_LIMIT" value="128mb"/>
  <configure name="MAGICK_DISK_LIMIT" value="256mb"/>
  <configure name="MAGICK_FILE_LIMIT" value="768"/>
...
convert -define registry:temporary-path=/data/tmp image.jpg image.png, tried it.

Debug Output:

Code: Select all

17:45:13 0:01 0.030u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/246.0mb
17:45:13 0:01 0.030u 6.0.7 convert[16202]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
17:45:13 0:01 0.030u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/246.0mb
17:45:13 0:01 0.030u 6.0.7 convert[16202]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/246.0mb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XXMV9Tex
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/AcquireMagickResource/209/Resource
 file: 1/1/12kb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XXvdMPtt
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/AcquireMagickResource/209/Resource
 file: 1/2/12kb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/246.0mb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/246.0mb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XXMV9Tex
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/1/12kb
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XXvdMPtt
17:45:13 0:01 0.040u 6.0.7 convert[16202]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/0/12kb
Still putting it in /tmp.

Any ideas?

Thank you,

~Shawn

signsrus

Re: Resource limits are not working

Post by signsrus »

putenv('MAGICK_TMPDIR=/home/magick');

Does not work either.

User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

Type
  • identify -verbose
and verify you are running ImageMagick 6.5.1. Next, type this command:
  • convert -debug cache -limit area 0 -define registry:temporary-path=/data/tmp logo: logo.png
We get
  • 2009-04-20T20:43:52-04:00 0:00 0.000u 6.5.1 Cache convert[20360]: cache.c/DestroyPixelCacheInfo/1513/Cache
    destroy
    2009-04-20T20:43:52-04:00 0:00 0.000u 6.5.1 Cache convert[20360]: cache.c/ExtendCache/3748/Cache
    extend LOGO[0] (/data/tmp/magick-XXkOfLqN[3], disk, 2.93mb)
    2009-04-20T20:43:52-04:00 0:00 0.000u 6.5.1 Cache convert[20360]: cache.c/OpenPixelCache/3943/Cache
    open LOGO[0] (/data/tmp/magick-XXkOfLqN[3], disk, 640x480 2.93mb)
Notice how the pixel cache is allocated on disk in the /data/tmp folder as expected. Does this work for you?

signsrus

Re: Resource limits are not working

Post by signsrus »

Code: Select all

root [~]# identify -version
Version: ImageMagick 6.5.0-0 2009-03-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
/usr/bin/convert -debug cache,resource -limit area 0 -define registry:temporary-path=/home/magick users/21/29/2778034911cafa1f7cf/files/Talisma_Customer_Client.pdf -trim -resize '960x960>' users/21/29/2778034911cafa1f7cf/jpgs/Talisma_Customer_Client_pdf.png

Code: Select all

10:22:09 0:01 0.030u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:22:09 0:01 0.030u 6.0.7 convert[9931]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:22:09 0:01 0.040u 6.0.7 convert[9931]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:22:09 0:01 0.040u 6.0.7 convert[9931]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XX7mvUU1
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/AcquireMagickResource/209/Resource
 file: 1/1/12kb
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XXqvREqv
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/AcquireMagickResource/209/Resource
 file: 1/2/12kb
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:22:09 0:01 0.040u 6.0.7 convert[9931]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:22:09 0:01 0.040u 6.0.7 convert[9931]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XX7mvUU1
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/1/12kb
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XXqvREqv
10:22:09 0:01 0.040u 6.0.7 convert[9931]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/0/12kb
Now, .pdfs and I think anything else that write to the /tmp dir is failing where it was working before.

User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

It looks like you set the MAGICK_TEMPORARY_PATH variable in your configure.xml file. That overrides the command line settings.

signsrus

Re: Resource limits are not working

Post by signsrus »

Ok, well, I just compiled and installed 6.5.1-3 just fine.

Code: Select all

root@ [~]# identify -version
Version: ImageMagick 6.5.1-3 2009-04-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Its configure.xml lines for those vars are commented out.

Code: Select all

root [/usr/local/lib/ImageMagick-6.5.1/config]# tail configure.xml
  <configure name="WEBSITE" value="http://www.imagemagick.org"/>
  <configure name="QuantumDepth" value="16"/>
  <!-- <configure name="MAGICK_TEMPORARY_PATH" value="/tmp"/> -->
  <!-- <configure name="MAGICK_MEMORY_LIMIT" value="2gb"/> -->
  <!-- <configure name="MAGICK_MAP_LIMIT" value="8gb"/> -->
  <!-- <configure name="MAGICK_AREA_LIMIT" value="4gb"/> -->
  <!-- <configure name="MAGICK_DISK_LIMIT" value="16eb"/> -->
  <!-- <configure name="MAGICK_FILE_LIMIT" value="768"/> -->
  <!-- <configure name="MAGICK_THREAD_LIMIT" value="8"/> -->
</configuremap>
I am getting the same results with the previous command line.

/usr/bin/convert -debug cache,resource -limit area 0 -define registry:temporary-path=/home/magick users/21/29/2778034911cafa1f7cf/files/Talisma_Customer_Client.pdf -trim -resize '960x960>' users/21/29/2778034911cafa1f7cf/jpgs/Talisma_Customer_Client_pdf.png

Code: Select all

10:58:51 0:01 0.040u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:58:51 0:01 0.040u 6.0.7 convert[23440]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:58:51 0:01 0.050u 6.0.7 convert[23440]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:58:51 0:01 0.050u 6.0.7 convert[23440]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XXHAKlqG
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/AcquireMagickResource/209/Resource
 file: 1/1/12kb
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/AcquireUniqueFileResource/369/Resource
 /tmp/magick-XXvucrZs
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/AcquireMagickResource/209/Resource
 file: 1/2/12kb
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:58:51 0:01 0.050u 6.0.7 convert[23440]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 area: 0/0/0
10:58:51 0:01 0.050u 6.0.7 convert[23440]: cache.c/DestroyCacheInfo/1193/Cache
 destroy
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XXHAKlqG
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/1/12kb
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishUniqueFileResource/743/Resource
 /tmp/magick-XXvucrZs
10:58:51 0:01 0.050u 6.0.7 convert[23440]: resource.c/RelinquishMagickResource/710/Resource
 file: 1/0/12kb
No env vars for IM are set for user 'nobody'

Code: Select all

CONSOLE=/dev/console
SELINUX_INIT=YES
TERM=linux
INIT_VERSION=sysvinit-2.85
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
_=/usr/bin/printenv
runlevel=3
RUNLEVEL=3
PWD=/home/StableSite/admin
LANG=en_SG.UTF-8
previous=N
PREVLEVEL=N
SHLVL=3
HOME=/
What now?

Thank you,

~Shawn

signsrus

Re: Resource limits are not working

Post by signsrus »

I tried uncommenting the configure.xml lines and putting in /home/magick. I then tried removing the command line attribute for the dir.

Nothing is working whatsoever at all.

Please help.

signsrus

Re: Resource limits are not working

Post by signsrus »

On a side note, ever since I restarted the server, now the .pdfs won't convert. PNGs and JPGs are working fine. Before I restared the server, I could convert PDFs to PNGs as per the above command just fine. Then after I rebooted so the server would read the new env vars, PDFs stopped working. Then I upgraded the version and they still don't work.

This is driving me totally mad. Please help.

Thank you.

User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

You say /usr/bin/convert shouldn't that be /usr/local/bin/convert?

signsrus

Re: Resource limits are not working

Post by signsrus »

I can't see any debug output now with using /usr/local/bin/convert.

.ai and .pdf files still aren't working.

User avatar
magick
Site Admin
Posts: 11218
Joined: 2003-05-31T11:32:55-07:00

Re: Resource limits are not working

Post by magick »

Unfortunately we cannot reproduce any of the problems you are having. Until we can reproduce the problem, we can't offer any additional help.

Post Reply