[mapserver-users] mapObj does not close MS_ERRORFILE handle in MapServer 6.0

Anzel, Phil - NRCS, Fort Collins, CO Phil.Anzel at ftc.usda.gov
Wed Dec 21 17:10:12 EST 2011


Hi, All,

I believe that the mapObj's Dispose() method does not close the file handle for the MS_ERRORFILE under MapServer 6.0, when used via the SWIG MapScript API for C#.

Here's the context, presented as C# fragments, and please bear with me for the length of this:

  using OSGeo.MapServer;
  ...
  string mapfile = @"MAP
                       CONFIG 'MS_ERRORFILE' "c:/.../mapserver.log"
                       DEBUG 3
                       imagetype 'png'
                       ...
                       LAYER
                         ...
                       END
                     END";
  mapObj mo = mapscript.msLoadMapFromString(mapfile, null);
  imageObj io = mo.draw();
  mo.Dispose();
  byte[] img = io.getBytes();
  ...dump the "img" to a file (such as a ".png" file)
  io.Dispose;

By way of demonstration, if I use this code in a "Console" application, and set a break point right after the "io.Dispose", a directory listing shows a zero length for the mapserver.log file. If I let the application terminate normally, I see the size of the mapserver.log file grow to the expected 1KB or so, and I see that the file contains the expected elapsed time information appropriate to "DEBUG 3". In my test use, the "mapfile" string is well-formed and a reasonable ".png" file is created.

Should I be calling some additional method on the mapObj instance to force ERRORFILE file closure? Is there some other explanation for the behavior reported here?

Thanks

- Phil Anzel 
  Vistronix Inc for USDA/NRCS/ITC

This electronic message contains information generated by the USDA solely for the intended recipients.  Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties.  If you believe you have received this message in error, please notify the sender and delete the email immediately.




More information about the mapserver-users mailing list