Ticket #1854 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

saveimage crash

Reported by: brage@… Owned by: jmckenna@…
Priority: high Milestone: 5.0 release
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc: jmckenna@…

Description

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.

Change History

Changed 7 years ago by dmorissette

  • cc jmckenna@… added
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?

Changed 7 years ago by brage@…

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.

Changed 7 years ago by dmorissette

Jeff: Do you want to take this one to add a FAQ?

Changed 7 years ago by dmorissette

  • milestone set to 4.10 release

Changed 7 years ago by jmckenna@…

  • owner changed from mapserverbugs to jmckenna@…
ok.

Changed 7 years ago by dmorissette

  • cc dmorissette@… added

Changed 7 years ago by assefa

  • milestone changed from 4.10 release to FUTURE

Changed 7 years ago by assefa

  • milestone changed from FUTURE to 4.10 release
I accidently set the bug target to FUTURE. ressetting to 4.10

Changed 6 years ago by jmckenna

  • status changed from new to closed
  • resolution set to fixed

I have added a note regarding this in the FAQ section of  http://mapserver.gis.umn.edu/docs/howto/phpmapscript-install

Note: See TracTickets for help on using tickets.