<br><font size=2 face="sans-serif">Hello Umberto</font>
<br>
<br><font size=2 face="sans-serif">Thank you for yout hint's!</font>
<br>
<br><font size=2 face="sans-serif">You are right: One should be cautios.
But for the moment I have the impression</font>
<br><font size=2 face="sans-serif">that we seeme to have found a way, which
don't raise obvious errors in the first </font>
<br><font size=2 face="sans-serif">moment :-)</font>
<br>
<br><font size=2 face="sans-serif">After the mentioned changes in mapcopy.c
the approache </font>
<br><font size=2 face="sans-serif">(TomCat/MapScript/Connection-Pooling/MapCloning)
seeme to </font>
<br><font size=2 face="sans-serif">work for us. (Working with Version 4.6)</font>
<br>
<br><font size=2 face="sans-serif">But:</font>
<br><font size=2 face="sans-serif">- We do need some more stress-testing.(We
already made automated </font>
<br><font size=2 face="sans-serif">&nbsp; http-requests from a Java-Programs.
But this was definitly not enough and </font>
<br><font size=2 face="sans-serif">&nbsp; not &quot;nasty&quot; enough!)</font>
<br><font size=2 face="sans-serif">- New problems could raise, if more
or other features from mapserver/mapscript</font>
<br><font size=2 face="sans-serif">&nbsp; are used then we actualy do.
</font>
<br><font size=2 face="sans-serif">- Memory footprint of the running-tomcat
has to be watched!. What about the size </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp;of the application after
100, 500, 600, 800 ... requests? (I'm not quite shure how to do this!</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp;Watching Java-Programs
is difficult because of garbage-collections ...)</font>
<br>
<br><font size=2 face="sans-serif">Greetings</font>
<br><font size=2 face="sans-serif">Benedikt</font>
<br>
<br><font size=2><tt>Umberto Nicoletti &lt;umberto.nicoletti@gmail.com&gt;
schrieb am 29.06.2005 11:03:46:<br>
<br>
&gt; On 6/29/05, Benedikt Rothe &lt;umn-ms@hydrotec.de&gt; wrote:<br>
&gt; &gt; &nbsp;<br>
&gt; &gt; Dear List <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; We are using MapScript/Tomcat/Java/OracleSpatial. <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; We use mapObj.mapClone() to get a fresh mapObject <br>
&gt; &gt; in each request without reading the Mapfile. <br>
&gt; <br>
&gt; Benedikt,<br>
&gt; I would not do that (tm). In my apps I recreate a fresh mapObj with<br>
&gt; each request &nbsp;as the overhead is mininum and the benefits high
(so<br>
&gt; that the ratio is in favor of this approach).<br>
&gt; Besides this is the only known method to work (as far as I know) and<br>
&gt; this stems from the fact that mapserver was in the beginning (and<br>
&gt; still is, with improvements) a CGI. As you might know cgis are<br>
&gt; processes that are created by the web server to serve a single request<br>
&gt; and then exit, so memory cleanup and thread safety are non-issues
for<br>
&gt; them.<br>
&gt; Even in php mapscript php must be used as a cgi (instead of a DSO)
to<br>
&gt; make sure that it works.<br>
&gt; <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; We detected problems after we activated Connection-Pooling: <br>
&gt; &gt; Tomcat crashed in mapObj.delete() <br>
&gt; &gt;<br>
&gt; <br>
&gt; I would not use connection pooling just because it will not work<br>
&gt; reliably with Java Servlets for the reasons explained above.<br>
&gt; <br>
&gt; This matter (connection pooling and map cloning) surely requires<br>
&gt; deeper investigation, one of the developers coul step in to give his<br>
&gt; opinion on my statements (which I would sincerely hope were false,
but<br>
&gt; fear not). Btw, I seem to recall that the above issues (long lived<br>
&gt; instance against per request instance) &nbsp;were already discussed
on the<br>
&gt; list before.<br>
&gt; <br>
&gt; Best regards,<br>
&gt; Umberto<br>
&gt; &nbsp; <br>
&gt; &gt; Hole thing turned out to be a bug in mapcopy.c where <br>
&gt; &gt; the joins are copied: <br>
&gt; &gt; -------------------- <br>
&gt; &gt; MS_COPYSTELEM(numjoins); <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; for (i = 0; i &lt; dst-&gt;numprocessing; i++) { <br>
&gt; &gt; &nbsp; &nbsp;return_value = msCopyJoin(&amp;(dst-&gt;joins[i]),
&amp;(src-&gt;joins[i])); <br>
&gt; &gt; -------------------- <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; This must be changed to <br>
&gt; &gt; -------------------- <br>
&gt; &gt; MS_COPYSTELEM(numjoins); <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; for (i = 0; i &lt; dst-&gt;numjoins; i++) { <br>
&gt; &gt; &nbsp; &nbsp;return_value = msCopyJoin(&amp;(dst-&gt;joins[i]),
&amp;(src-&gt;joins[i])); <br>
&gt; &gt; -------------------- <br>
&gt; &gt; &nbsp;<br>
&gt; &gt; There is some other code in mapobject.c, wich didn't <br>
&gt; &gt; raise any problems for us, but from wich I do think <br>
&gt; &gt; that array-allocs are missing. <br>
&gt; &gt; I watched the code an *think* these are are not allocated <br>
&gt; &gt; anywhere. I hope, there is no misleading hint: <br>
&gt; &gt; <br>
&gt; &gt; &nbsp;----------------------------<br>
&gt; &gt; &nbsp;// I do think, that dst-&gt;point is not allocated.<br>
&gt; &gt; &nbsp;// code seems to be unused (?)<br>
&gt; &gt; &nbsp;dst-&gt;numpoints = src-&gt;numpoints;<br>
&gt; &gt; &nbsp;for (i = 0; i &lt; dst-&gt;numpoints; i++) {<br>
&gt; &gt; &nbsp; MS_COPYPOINT(&amp;(dst-&gt;point[i]), &amp;(src-&gt;point[i]));<br>
&gt; &gt; &nbsp;}<br>
&gt; &gt; &nbsp;----------------------------<br>
&gt; &gt; &nbsp;// I do think, that dst-&gt;items and dst-&gt;values is<br>
&gt; &gt; &nbsp;// not allocated<br>
&gt; &gt; &nbsp;MS_COPYSTELEM(numitems);<br>
&gt; &gt; &nbsp;for (i = 0; i &lt; dst-&gt;numitems; i++) {<br>
&gt; &gt; &nbsp; MS_COPYSTRING(dst-&gt;items[i], src-&gt;items[i]);<br>
&gt; &gt; &nbsp; MS_COPYSTRING(dst-&gt;values[i], src-&gt;values[i]);<br>
&gt; &gt; &nbsp;}<br>
&gt; &gt; &nbsp;<br>
&gt; &gt; &nbsp;-----------------------------<br>
&gt; &gt; &nbsp;// I'm quite shure, that dst-&gt;items is not allocated<br>
&gt; &gt; &nbsp;MS_COPYSTELEM(numitems);<br>
&gt; &gt; &nbsp;<br>
&gt; &gt; &nbsp;for (i = 0; i &lt; dst-&gt;numitems; i++) {<br>
&gt; &gt; &nbsp; MS_COPYSTRING(dst-&gt;items[i], src-&gt;items[i]);<br>
&gt; &gt; &nbsp;}<br>
&gt; &gt; &nbsp;<br>
&gt; &gt; I hope this is helpful. Greetings <br>
&gt; &gt; Benedikt Rothe<br>
</tt></font>