Page 1 of 1

exit code 11

Posted: 2008-09-23T13:11:33-07:00
by Zimrilim
I was told I should post about this here.
The previous discussion can be found at this link:
viewtopic.php?f=1&t=12094

I have a command that returns "Exit Code 11" I wonder what this means.

This is the command:
convert 'defined location/something' -resize 1100x1100\> -quality 95 'name.png'

identify -version returns:
Version: ImageMagick 6.3.5 08/01/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

We have full access to the image directory.

Hope you can explain what causes this error.

Re: exit code 11

Posted: 2008-09-23T16:22:10-07:00
by magick
ImageMagick returns 0 on success and 1 if an exception occurs. For anything else we would need to reproduce the problem to help further. Post a URL to your image and the command you use. Hopefully we will get the same exit code and be able to track the source of the errant exit code.

Re: exit code 11

Posted: 2008-09-23T23:58:00-07:00
by Zimrilim
Well to be honest the command is part of a php script processing usually a few hundred images after one another. All the images have the error. The script itself is thus dependent on a large amount of files.

I have already tried to replicate the error on my local machine with one of the images used and the same command (also listed here.) This resulted in a successful conversion.

Although the locations of the image are parsed through a php command called escapeshellarg() This adds single quotes around the escaped argument. Is this a problem on linux? I know it doesn't parse on windows though. But it used to work even with this command before.

Re: exit code 11

Posted: 2008-09-24T00:35:34-07:00
by anthony
I suggest you get it to print some copy of the command string afetr escape shell args.

Remember in PHP the command are passed to shell and shell needs to decode the command line string into sepatate arguments for IM.
It may be the escapeshellarg() is stuffing things up. It may not be.

It is a shame PHP does not have the ability to by-pass the shell parsing as just about all other languages do for command calls as this would make your and everyone elses usage of PHP with Command Line ImageMagick a LOT easier, simpler to understand, and much more secure.

NOTE escapeshellarg() is useally used only to pass uncontrolled user input strings to PHP command calls. Everything else is generally generated by the program or is static, so is not a security problem.

Re: exit code 11

Posted: 2008-10-01T06:34:22-07:00
by Zimrilim
The command:

/usr/local/bin/convert '/home/flexsl0/public_html/magicforestry/temp/1222866715UZGXFF/Test/Chapter_1/38.png' -resize 1100x1100\> -quality 95 '../../manga/images/32/1.png


This gives exit code 11

The output of the command is empty. According to php.net it is an array containing every line of output. So this error occurs before there is even one line of output.

This goes on for as much pictures there are in the temp file. I am accessing the right directory for the images.

Re: exit code 11

Posted: 2008-10-01T17:57:33-07:00
by anthony
Missing quote! Add one to the end. The exit code would thus be from the shell, and NOT from convert.

Now if you wrap this into PHP you need souble quotes around it.
That means the '\' needs to be doubled, but the single quotes do not. No need for escapeshellargs, unless you do that for the file names and then leave of the single quotes.

The shell needs to receve it exactaly as you have above (with the missing final quote.

CHECK the command string produced carefully.

Re: exit code 11

Posted: 2008-10-01T23:30:14-07:00
by Zimrilim
Why yes, it is actually missing. However I have checked and was just an error in the way I returned the command string. I accidentally closed a bracket at the wrong place so the closing quote was outputted on the next line. It is there though.

The commando is thus:
/usr/local/bin/convert '/home/flexsl0/public_html/magicforestry/temp/1222866715UZGXFF/Test/Chapter_1/38.png' -resize 1100x1100\> -quality 95 '../../manga/images/32/1.png'

Re: exit code 11

Posted: 2008-10-11T07:14:41-07:00
by Zimrilim
Things have changed now. It suddenly works again, although if we use images previously converted through this script we get exit code 139.

I have no idea what has changed, but it is resolved.

Re: exit code 11

Posted: 2008-11-05T17:08:24-07:00
by anthony
An exit code larger than 128 is a program killed by a signal, or system error
139 - 128 => 11 => signal SIGSEGV

That means the program was killed by a segmentation fault, which is usually a memory failure. This is a serious problem, and IM has tried to eliminate all such problems.

Unfortunately, IM may not be the source of this fault.

At this time if IM uses the RSVG delegate library the library causes IM to fail during final cleanup with a segmentation fault from the RSVG library itself. This is beyond the control of the developers.

This is also a pain in IM Examples, and happens whenever I try to read a SVG image :-(

Fortunately the fault happens AFTER IM has completely finished and written the result.


The question however is why are you getting a SEGV, especially as you seem to only be dealing with PNG images? Does it actually produce a correct final image?

Remember a SEGV may be from IM, or it could be from the shell!
try adding other shell commands, in the same shell parse string after the IM command, to see if the error is from IM orthe shell.

Then try creating a simper 'test PHP' script on your web server to see if you can figure out what causes the SEGV. In other words, simplify, simplify, simplify until you know what is the cause of the SEGV fault.

Re: exit code 11

Posted: 2008-11-06T00:29:08-07:00
by Zimrilim
Thanks, but we are completely devoid of any problems since we got our hosting to upgrade to the newest version of IM. But thanks for all of your advice.