Opened 12 years ago

Last modified 12 years ago

#4182 new defect

Crash of PHP MapScript when creating new Map object

Reported by: armin Owned by: aboudreault
Priority: normal Milestone: 6.0.1 release
Component: MapScript-PHP Version: 6.0
Severity: normal Keywords:
Cc:

Description

I have the following crash of PHP scripts using MapScript 6.0.1 taken from "branches/branch-6-0" when creating a Map object:

using a very basic map file

  MAP
    NAME "test"
  END

and running the script

 <?php
   $mapFile = "test.map";
   $oMap = ms_newMapobj($mapFile);
 ?>

causes a crash with a backtrace as seen attached (one file is the direct output, the other one created from the core dump via gdb).

The environment is Debian 6 64bit:

  • kernel 2.6.32-5-amd64 (Debian 2.6.32-35)
  • gcc version 4.3.5 (Debian 4.3.5-4)
  • libc6 version 2.11.3-2

Attachments (2)

backtrace_ms601_php5310.txt (6.4 KB ) - added by armin 12 years ago.
backtrace_gdb_ms601_php5310.txt (10.0 KB ) - added by armin 12 years ago.

Download all attachments as: .zip

Change History (11)

by armin, 12 years ago

Attachment: backtrace_ms601_php5310.txt added

by armin, 12 years ago

comment:1 by armin, 12 years ago

Forgot to add:

PHP is version 5.3.10, compiled from source. Error happens both with PHP cli and Apache module.

comment:2 by armin, 12 years ago

This error does not appear with MapScript compiled for PHP 5.2.17.

comment:3 by aboudreault, 12 years ago

I am not able to reproduce this issue using MS 6.0 and MS trunk neither.

comment:4 by armin, 12 years ago

one of the main problems with the rewritten PHP MapScript of MS 6 is that the errors appear typically under very special circumstances. One error just with PHP 5.2 but not with PHP 5.3, the other error just on Debian-6 64bit but not Debian-5 32bit. Now just with PHP 5.3 and not 5.2

I wanted to to swap to PHP 5.3 because there was a strange error with PHP 5.2 and WxS requests for some BBOX extents, like one negative ymin and positive ymax. This made made it difficult to use PHP MapScript for WMS requests because some requests always fail with a crashed apache process (this error does not appear under the same installation type on Debian 5). I was hoping to get rid of it with PHP 5.3, but now I'm stuck with this new error.

comment:5 by aboudreault, 12 years ago

Armin, I remind you had another very strange issue. I don't know if your environment is broken somehow but it's hard for me to debug them, although I would be glad to be able. I do not use Debian. Have you tried a simple test using a new debian machine (or virtual machine) with clean installation of your packages (all from debian packages). If the issue happens.... maybe it could be something to report to Debian directly. Keep me posted...

comment:6 by armin, 12 years ago

yes, I had other strange issues with MS 6, but they were bugs that had been fixed after someone else stumbled over the same problem and reported it as well... The installation is a standard Debian with some libraries related to Mapserver compiled by myself (gd, gdal, proj4, geos, Postgres/gis, PHP). I never ever had any problems with PHP MapScript (4.0 to 5.6) in this mentioned constellation until I tested MS 6...

Since I mainly need MS 6 for correct implementation of WMS 1.3.0 standard, I might try to port everything now to Python Mapscript and see if this is working more stable and predictable.

Thanks Armin

comment:7 by aboudreault, 12 years ago

I do not consider PHP MapScript as unstable. A lot of users are using it without any important issues. Although I like the idea to migrate to Python... the python bindings is in swig and might be limited, unstable and unpredictable if your system is complex. Again, I would be very glad to fix that issue but I need to be able to reproduce it somehow. Since you have compiled a lot of libraries yourself... It's hard to reproduce your environment. I see the Abort happens during the libproj loading?? The php code you pasted doesn't need any reprojection at all. Right? I'm to help you to fix this issue... just need to find a way to work together and get the same crash.

comment:8 by armin, 12 years ago

no reprojection, the map file is practically empty and probably the minimum possible, and the script is just trying to create a map object, nothing more.

But I don't see why the proj library should be causing this. If I look at the gdb backtrace, the abort is later on. I'm not a C programmer but for me it looks like being related to whatever regex function, but I might be wrong.

comment:9 by aboudreault, 12 years ago

I'm going to take a deeper look at this... and see if I have the traceback than you and If I'm using the same regex or something. Perhaps I could fix the issue kind of *blindly*. I'm going to get back to you.

Note: See TracTickets for help on using tickets.