[mapserver-users] Threads and Mapscript

Frank Warmerdam warmerdam at pobox.com
Thu Mar 21 09:29:02 EST 2002


Harald Wehr wrote:
> Using a cgi-script on a server for every request a new thread is opened,
> isn't it?
> 
> I use mapscript in a servlet. Every request makes a new thread. I save
> one mapObject in one java-session. Several requests (from different
> browsers) produce different mapObjects. Everything works right until
> here. I have different objects with different c-pointers.
> 
> Calling mapscript from one browser works fine. Calling it from another
> browser sometimes crashes my servlet-engine. It writes:
> "Unexpected exception outside virtual machine
> Function=msDrawRasterLayer+0x694
> Library=/urs/local/lib/libmapscript.so"
> This happens when i call the map.draw()-method. Do you have any 
> suggestions?
> 
> What happens when i call
> "mapscipt.saveImage(pointer,"file.png",2,1,0,95)" from different
> threads? Is this thread-safe even in all depending libraries?
> 
> Asking the "mapscript.get_ms_error" from different threads I always get
> the same c-pointer of the error. Is this right? Can I somehow get 
> error-Objects related to specific thread?

Harald,

Some work has been done on thread safe support in MapServer in January.  In
particular if configured with --with-threads MapServer will have a separate
map error object for each thread.  I have copied a few of my notes on
ThreadSafety into the Wiki at:

   http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ThreadSafety

Let me know if this helps with your threading problems.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-users mailing list