[MAPSERVER-USERS] thread safety

rich.fromm nospam420 at yahoo.com
Tue Feb 19 11:17:41 PST 2008



rich.fromm wrote:
> 
> inevitably if I throw enough requests at mapserver, it
> always crashes and brings down tomcat, usually within about an hour or
> two.
> 

After searching around the mailing list archives a bit more, I am beginning
to
suspect that this may be caused by the JVM gc, and maybe improper use of
delete() within mapscript:

 
http://www.nabble.com/Re%3A--UMN_MAPSERVER-USERS---mapserver--Java-VM-Crashes-using-the-Mapscript-API-to1548675.html#a1548675
 
http://www.nabble.com/mapscript-jvm-crash-on-removeLayer-to6206628.html#a6206628

>From reading through those threads, it's still not clear to me under
precisely
what circumstances it is necessary to call delete() on a java mapscript
object, and under what circumstances it is sufficient to let the garbage
collector handle it.  But examing my code further, I do appear to be
inconsistent.  Here is a simplified version of pseudo-code showing my object
creations and deletions:

--- begin ---
  mapObj map = new mapObj();

  pointObj pt1 = new pointObj();
  pointObj pt2 = new pointObj();
  rectObj rect = new rectObj();

  for (i ...) {
    layerObj layer = map.getLayer(i);
    for (j ...) {
      classObj class = layer.getClass(j);
      labelObj label = class.getLabel();
    }
  }

  imageObj img = map.draw();

  img.delete();
  map.delete();
--- end ---

Specifically I am NOT calling delete() on either of the pointObj's, on the
rectObj, on the layerObj in the outer loop, or on the classObj or labelObj
in
the inner loop.

I am going to try inserting the maximum number of applicable delete()'s and
see if that helps.

- Rich

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




More information about the MapServer-users mailing list