[MAPSERVER-USERS] thread safety

rich.fromm nospam420 at yahoo.com
Fri Feb 15 21:12:08 EST 2008


To what extent is mapserver currently thread safe?

Yes, I have read the page at:
  http://mapserver.gis.umn.edu/docs/faq/thread_safety
but it says:
  This FAQ applies to: MapServer 4.6, MapServer 4.8
and I'm wondering about 5.0.  (And there are some other things on it that I
don't understand as well, see details below.)

Here's my situation:

I am running mapserver 5.0.0 on debian 3.1 (sarge), locally compiled with
gcc
3.3.5, using locally compiled versions of GD 2.0.35 and AGG 2.5, and debian
packages for everything else.  My mapserver configuration is as follows:

MapServer version 5.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=WBMP OUTPUT=SVG
SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=THREADS INPUT=POSTGIS
INPUT=SHAPEFILE

I would imagine that the portions above that I am currently using are:
OUTPUT=PNG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=THREADS
INPUT=POSTGIS

I have a custom Java webapp that uses Java mapscript and runs with tomcat
5.5.17 and java 1.5.0, also on debian 3.1 (sarge).  It queries its data from
a
PostgreSQL/PostGIS database, uses projections, uses the AGG renderer,
includes
labels with TrueType fonts, and generates PNG output.  Each flow from
request
to response is a single thread, but tomcat is able to process multiple
concurrent requests if it receives them.

Small scale individual tests work fine.  When I try executing larger
scale stress tests that include multiple concurrent requests to tomcat,
things
run fine for a while, but eventually the JVM crashes and tomcat dies.  Some
examples of reported stack traces are given below.  I have not yet been able
to
reproduce a single failure -- I'm still working on it.  But if this is a
threading issue, I may not be able to get a reproducible test case.

And even if the list at the web page above is still current, it's not
entirely
clear to me as someone not familiar with mapserver internals how I can tell
whether or not some of those components apply to my particular situation.

There's this thread on the mailing list:

  http://www.nabble.com/forum/ViewPost.jtp?post=3215944&framed=y

which does say:

  "The --with-threads switch does not need to be used in normal cgi or
single
  threaded mapscript use."

although that mailing list thread doesn't really answer all of my questions,
because:

1) Much of it discusses FastCGI, which isn't applicable to my situation.

2) It's not clear to me whether a single thread of execution from the
   perspective of mapscript, but that can be invoked repeatedly from tomcat
   handling multiple concurrent connections (from either a multithreaded
   client or multiple single threaded clients) falls under the case of
"single
   threaded mapscript use.

3) The mailing list thread is nearly 2 years old.

Thanks for any help that anyone may be able to provide.

- Rich

---
crash #1:
(msClipPolygonRect) mapprimitive.c:649
(msDrawShape) mapdraw.c:1609
(msDrawVectorLayer) mapdraw.c:887
(msDrawLayer) mapdraw.c:718
(msDrawMap) mapdraw.c:432
(mapObj_draw) mapscript/java/mapscript_wrap.c:1714
(Java_edu_umn_gis_mapscript_mapscriptJNI_mapObj_1draw)
mapscript/java/mapscript_wrap.c:20612

crash #2:
(msClipPolygonRect) mapprimitive.c:605
(msDrawShape) mapdraw.c:1609
(msDrawVectorLayer) mapdraw.c:887
(msDrawLayer) mapdraw.c:718
(msDrawMap) mapdraw.c:432
(mapObj_draw) mapscript/java/mapscript_wrap.c:1714
(Java_edu_umn_gis_mapscript_mapscriptJNI_mapObj_1draw)
mapscript/java/mapscript_wrap.c:20612

crash #3:
(msFreeLabelCacheSlot) mapfile.c:4068
(msFreeLabelCache) mapfile.c:4100
(msFreeMap) mapobject.c:98
(delete_mapObj) mapscript/java/mapscript_wrap.c:1619
(Java_edu_umn_gis_mapscript_mapscriptJNI_delete_1mapObj)
mapscript/java/mapscript_wrap.c:19695

crash #4:
(msFreeLabelCacheSlot) mapfile.c:4068
(msFreeLabelCache) mapfile.c:4100
(msFreeMap) mapobject.c:98
(delete_mapObj) mapscript/java/mapscript_wrap.c:1619
(Java_edu_umn_gis_mapscript_mapscriptJNI_delete_1mapObj)
mapscript/java/mapscript_wrap.c:19695

-- 
View this message in context: http://www.nabble.com/thread-safety-tp15514019p15514019.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list