Java MapScript issues Servlet

Umberto Nicoletti unicoletti at PROMETEO.IT
Mon Feb 28 09:07:38 EST 2005


Quoting Joseph Miller <miller_joseph at BAH.COM>:

> Umberto,
>
> 1)I don't think I compiled specifically with multi-threading because it
> wasn't an option listed in the nmake.opt for Microsoft Visual C++  options
> file???  The last I heard multithreading was not even on the horizon for
> mapserver and yet I see it in the Unix build options file?  What do I need
> to do this?

I only use mapserver on linux, so I can't say much about windows. Except for
that I believe that thread support has been in mapserver for quite some time...

>
> 2)I tried both options you mentioned, I had the problem when passed the
> same mapObj from request to request and stored it in the session and when I
> set it to null after every request and instantiated it and assigned
> attributes based on other variables stored in the requests and sessions?
> I'm assuming the latter is preferred?
>

I think the per-request mapObj is preferrable to keeping mapObj in session and
that is partly because of the way mapserver (and mapscript) was meant to work in
the beginning, that's to say as a cgi. In fact a cgi is a process that is
created once for each request and then exits, so it is stateless.
A session approach might work too, but it would require some work to make sure
you initialize everything correctly.
Also the native code must be carefully checked for dealocks, memory leaks and so
on, so programming is much more challenging.

The disadvantages of the per request mapObj are relatively small and probably
evident only when accessing network resources like database where the
initialization part is significantly complex.

Regards,
Umberto

> Thanks,
> Joe Miller
>
> On Mon, 28 Feb 2005 09:44:21 +0100, Umberto Nicoletti
> <unicoletti at PROMETEO.IT> wrote:
>
> >Did you enable threads support?
> >Java, and especially servlets, are definitely highly concurrent
> >environment, so you have to enable thread support when compiling
> >mapserver and mapscript. One very problematic spot with regards to
> >threads is in fact the parser of .map files.
> >
> >Do you attempt to reuse the same mapObj across multiple requests or just
> >create one and dispose as soon as you are done within a single request?
> >
> >HTH,
> >Umberto
> >
> >
> >On Mon, 2005-02-28 at 00:53 -0500, Miller Joseph wrote:
> >> Hi,
> >> I'm having a baffling problem with a nightly build of Java Mapscript
> >> from about a month ago that I am running on Windows 2000 with Tomcat
> >> 5.5.4.
> >>
> >> The symptom I see is that I can generate the default image but after the
> >> fourth or fifth time that I pass a new envelope to change the extent of
> >> the image I get the following error:
> >>
> >> The relevant part of the stack trace:
> >> java.lang.UnknownError: Failed to draw layer named 'world'.
> >>         at edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native Method)
> >>         at edu.umn.gis.mapscript.mapObj.draw(mapObj.java:397)
> >>
> >> Occasionally I'll get a flex scanner error or tomcat will crash with an
> >> Exception_Access_Violation memmove error similar to the one referred to
> >> here:
> >> http://forum.java.sun.com/thread.jspa?forumID=52&messageID=1124599&threa
> >> dID=286832
> >>
> >> All of this happens whether I instatiate new instances of the mapObj and
> >> set everything to null or if I use the same mapObj throughout and only
> >> after a few passes, suggesting to me that there is a memory issue
> >> somewhere.  I can pass on some specific code, but all I am really doing
> >> is creating new envelopes to store extents and then assigning them to
> >> the mapObj or extracting the corner coordinates and setting the extent
> >> with them.
> >>
> >> I've been fighting this for a frustrating week now.  Does anyone have
> >> any advice?
> >>
> >> Thanks,
> >> Joe Miller
> >--
> >Umberto Nicoletti                               <Mercury> At that point it
> will
> >+390415701366   unicoletti at prometeo.it          compile, but segfault, as
> it should..
> >Prometeo S.R.L. The Software Experience
>
> Umberto,
>
> 1)I don't think I compiled specifically with multi-threading because it
> wasn't an option listed in the nmake.opt for Microsoft Visual C++  options
> file???  The last I heard multithreading was not even on the horizon for
> mapserver and yet I see it in the Unix build options file?  What do I need
> to do this?
>
> 2)I tried both options you mentioned, I had the problem when passed the
> same mapObj from request to request and stored it in the session and when I
> set it to null after every request and instantiated it and assigned
> attributes based on other variables stored in the requests and sessions?
> I'm assuming the latter is preferred?
>
> Thanks,
> Joe Miller
>



More information about the mapserver-users mailing list