MapServer / MapServer-import

3 stars 2 forks source link

saveimage crash #1854

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: brage@zoo.uib.no Date: 2006/08/08 - 11:36

I have been experiencing the exact same bug as described in bug #1269, with
mapscript terminating in saveimage() while writing to sdout. The httpd process
give the warning "httpd in free(): error: modified (page-) pointer" and exits. 

After some debugging, i found that the problematic call is the call to gdFree()
in saveImage().

My setup has php loading both gd.so and php_mapscript.so at startup in
php/extensions.ini.

The problem seems to be a mismatch of gd versions. The php gd module compiles
its own version of libgd, and if the gd library is loaded before the mapscript
library, mapscript will use the php-spesific version. This should not be a
problem, except that the php version of gd.so doesn't export gdFree(). In the
php version of libgd, gdFree() is defined as a macro to efree(). The gdFree()
called by mapscript then belongs to the gd linked to mapscript and the
alloc-code used by msSaveImageBufferGD() and gdFree() does not match.

A workaround is to load the php_mapscript module before the gd module.
tbonfort commented 12 years ago

Author: dmorissette Date: 2006/08/14 - 21:44

I don't think there is much we can do about this except reminding users that
they should not use the PHP bundled GD with PHP MapScript but instead they
should use a gd.so built with the same GD as PHP MapScript.

What do you suggest brage? Perhaps add something about this to the FAQ?
tbonfort commented 12 years ago

Author: brage@zoo.uib.no Date: 2006/08/15 - 13:04

Adding a note to the FAQ seems like a good idea. It should perhaps be noted that
it is only a problem if gd.so is dynamically loaded prior to mapscript.so.

I suspect I was lucky having BSD malloc issue a warning and killing the process,
I guess the effects might be more subtle on others systems.
tbonfort commented 12 years ago

Author: dmorissette Date: 2006/08/15 - 15:00

Jeff: Do you want to take this one to add a FAQ?
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2006/08/15 - 16:11

ok.
tbonfort commented 12 years ago

Author: assefa Date: 2006/08/25 - 21:31

I accidently set the bug target to FUTURE. ressetting to 4.10
tbonfort commented 12 years ago

Author: jmckenna Date: 2007/09/11 - 23:44 I have added a note regarding this in the FAQ section of http://mapserver.gis.umn.edu/docs/howto/phpmapscript-install