MapScript C# Memory Corruption Problem (MapServer 4.10)

Hong ljfong at SDF.LONESTAR.ORG
Fri Jan 19 20:03:53 EST 2007


Hi Tamas,

I have created a skeleton application that can show the map and the user can
"refresh", "zoom in", or "zoom out" on the map. The map draws without problem
on "refresh", but it will crash with either the memory corruption message or
the SDE connection exception randomly. Typically the crash occurs after the
3rd or 4th call to zoomPoint() followed by draw() subroutine. The SDE
connection exception is:

msDrawMap(): Image handling error. Failed to draw layer named 'District';
msSDELayerOpen(): SDE error. SE_Version_get_info(): Bad connection handle.
(-92)

All the layers in the map file are SDE layers accessed using ArcSDE 9.1
libraries.

I am sure that the correct versions of the dlls are loaded as the problem
disappears after I switch back to the old 4.8.4 dlls. I also verified the
dependencies using dependency walker to show the paths.

As for the call stack, this is what I got after the protected memory error:

[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
   System.Diagnostics.StackTrace.GetStackFramesInternal(StackFrameHelper sfh, Int32 iSkip, Exception e) +0
   System.Diagnostics.StackTrace.CaptureStackTrace(Int32 iSkip, Boolean fNeedFileInfo, Thread targetThread, Exception e) +49
   System.Diagnostics.StackTrace..ctor(Exception e, Boolean fNeedFileInfo) +32
   System.Web.UnhandledErrorFormatter.get_ColoredSquare2Content() +579
   System.Web.UnhandledErrorFormatter.PrepareFormatter() +42
   System.Web.ErrorFormatter.GetHtmlErrorMessage(Boolean dontShowSensitiveInfo) +51
   System.Web.HttpResponse.WriteErrorMessage(Exception e, Boolean dontShowSensitiveErrors) +787
   System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute) +478
   System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e) +541


I am sending testpage.aspx, testpage.aspx.vb for the sample app and Odessa.map
for the mapfile I used directly to your email account.

Thanks.

Hong


On Fri, Jan 19, 2007 at 10:34:06AM +0100, Tamas Szekeres wrote:
> Could you provide the code sample and possibly a call stack to locate
> this error?
> Are you sure that the correct versions of the dll-s are loaded?
> 
> Best Regards,
> 
> Tamas Szekeres
> 
> 
> 2007/1/19, Hong <ljfong at sdf.lonestar.org>:
> >Hi,
> >
> >I recently tried building MapServer 4.10 from the build kit
> >(mapserver-buildkit-011607.zip) using MS Visual Studio 2005 SP1. The build 
> >was
> >successful but during regular operation, there would be memory corruption 
> >that
> >happened sporadically (randomly when calling draw() function of mapObj). 
> >The
> >message was:
> >
> >Attempted to read or write protected memory. This is often an indication 
> >that
> >other memory is corrupt.
> >
> >The following DLLs were produced and used:
> >- bgd.dll (from separately downloaded gdwin32 package)
> >- libmap.dll (with manifest attached through 'mt')
> >- mapscript.dll (with manifest attached through 'mt')
> >- mapscript_csharp.dll
> >
> >This problem did not happen with MapServer 4.8.4 buildkit
> >(mapserver-4.8.3-msvc71-build-kit.zip) built using MS Visual Studio 2003. 
> >The
> >4.8.4 binaries had been running in .NET 2.0 environment without any 
> >problem.
> >
> >I can use any suggestion/help here.
> >
> >Thanks.
> >
> >Surya
> >



More information about the mapserver-users mailing list