[mapserver-users] Memoryproblem

Tamas Szekeres szekerest at gmail.com
Wed Aug 13 13:21:07 PDT 2008


Johan,

Could you try this out with a debug build? You can change the OPTFLAGS
section in nmake.opt by commenting out the # Debug with MSVCRT
section.
You should also add /debug:full to the csc command line in
/mapscript/csharp/makefile.vc
Finally you should enable the just in time debug option in the Visual
Studio IDE.
I hope this will help to locate the function that causes the problem
in the mapserver core.


Best regards,

Tamas



2008/8/13 Hallgren, Johan <johan.hallgren at logica.com>:
> Hello
>
> I have MapServer 5.2.0 and I have built the bin by myself. I use Windows Server 2003 standard edition.
>
> I also have tried to turn off all layers in the file and I have also removed all layes from the mapfile and still there is the same problem.
>
> Here is the file:
> +++++++++++++++++++++++++++
> #
> # Start of map file
> #
> MAP
>  NAME GIMS
>  STATUS ON
>  EXTENT 223559 6043080 2944725 7727610
> #               1470448 6850024 1471966 6851089
>  SIZE 500 500
>  UNITS METERS
>  IMAGECOLOR 255 255 255
>  FONTSET "D:\apps\GMSAgent\MapFiles\fonts.txt"
>  SYMBOLSET "D:\apps\GMSAgent\MapFiles\Symbol\symbolset.sym"
>  SHAPEPATH "D:\data\Mapdata\GIMS"
>  RESOLUTION 96
> # DEBUG 5
> # CONFIG "MS_ERRORFILE" "D:\apps\GMSAgent\log\mapserver.log"
>
> #  IMAGETYPE PNG
>  OUTPUTFORMAT
>   NAME 'AGG'
>   DRIVER AGG/PNG
>   IMAGEMODE RGB
>  END
>
>  WEB
>    TEMPLATE "c:\temp\template.txt"
>  END
>
>  #
>  # Start of legend
>  #
>  LEGEND
>    KEYSIZE 18 12
>    LABEL
>      TYPE BITMAP
>      SIZE MEDIUM
>      COLOR 0 0 89
>    END
>    STATUS ON
>    #STATUS embed
>  END
>
>  #
>  # Start of layer definitions
>  #
>
>  LAYER
>    NAME "Sjöar"
>    TYPE POLYGON
>    STATUS ON
>    DATA "vv/sj"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 750000
>    CLASS
>      STYLE
>        OUTLINECOLOR 0 0 255
>        COLOR 165 250 255
>      END
>    END
>  END
>
>  LAYER
>    NAME "Stora Sjöar"
>    TYPE POLYGON
>    STATUS ON
>    DATA "vv/sj_large"
>    TEMPLATE "c:\temp\template.txt"
>    MINSCALE 750000
>    CLASS
>      STYLE
>        OUTLINECOLOR 0 0 255
>        COLOR 165 250 255
>      END
>    END
>  END
>
>  LAYER
>    NAME "Sveriges vatten"
>    TYPE POLYGON
>    STATUS ON
>    DATA "vv/rsv_hv_grid"
>    TEMPLATE "c:\temp\template.txt"
>    MINSCALE 30000
>    CLASS
>      STYLE
>        COLOR 165 250 255
>      END
>    END
>  END
>
>  LAYER
>    NAME "Öar"
>    TYPE POLYGON
>    STATUS ON
>    DATA "vv/Or"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 300000
>    MINSCALE 30000
>    CLASS
>      STYLE
>        OUTLINECOLOR 0 130 255
>        COLOR 255 255 255
>      END
>    END
>  END
>
>  LAYER
>    NAME "Tätorter"
>    TYPE POLYGON
>    STATUS ON
>    DATA "vv/TATYT"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 1000000
>    CLASS
>      STYLE
>        OUTLINECOLOR 0 0 0
>        COLOR 210 210 210
>      END
>    END
>  END
>
>  LAYER
>    NAME "Vägar"
>    TYPE LINE
>    STATUS ON
>    DATA "vv/vdb_m"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 2000000
>    CLASS
>      EXPRESSION ([VAEGNR] > 1 AND [VAEGNR] < 100)
>      STYLE
>        SYMBOL solid
>        SIZE 2
>        COLOR 105 105 105
>      END
>    END
>    CLASS
>      MAXSCALE 1000000
>      EXPRESSION ([VAEGNR] >= 100 AND [VAEGNR] < 500)
>      STYLE
>        SYMBOL solid
>        SIZE 2
>        COLOR 105 105 105
>      END
>    END
>    CLASS
>      MAXSCALE 1000000
>      EXPRESSION ([VAEGNR] >= 500)
>      STYLE
>        COLOR 105 105 105
>      END
>    END
>  END
>
>  LAYER
>    NAME "Gränser"
>    TYPE LINE
>    STATUS ON
>    DATA "vv/Granser"
>    TEMPLATE "c:\temp\template.txt"
>    CLASS
>      EXPRESSION ([TYP] = 5)
>      STYLE
>        SYMBOL dot
>        COLOR 255 173 0
>        SIZE 2
>      END
>    END
>    CLASS
>      EXPRESSION ([TYP] = 6)
>      STYLE
>        COLOR 255 173 0
>      END
>    END
>    CLASS
>      EXPRESSION ([TYP] = 7)
>      STYLE
>        COLOR 255 173 0
>      END
>    END
>    CLASS
>      EXPRESSION ([TYP] = 8)
>      STYLE
>        SYMBOL solid
>        COLOR 255 173 0
>        SIZE 2
>      END
>    END
>  END
>
>  LAYER
>    NAME "Vattendrag"
>    TYPE LINE
>    STATUS ON
>    DATA "vv/vd"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 500000
>    CLASS
>      STYLE
>        COLOR 0 219 255
>      END
>    END
>  END
>
>  LAYER
>    NAME "Texter"
>    TYPE LINE
>    STATUS ON
>    DATA "vv/TATTXT"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 1250000
>    LABELITEM "TEXT"
>    CLASS
>      LABEL
>        ENCODING CP437
>        TYPE truetype
>        FONT verdanab
>        SIZE 10
>      END
>    END
>  END
>
>  LAYER
>    NAME "Texter småorter"
>    TYPE LINE
>    STATUS ON
>    DATA "vv/SMAORTTX"
>    TEMPLATE "c:\temp\template.txt"
>    MAXSCALE 1250000
>    LABELITEM "TEXT"
>    CLASS
>      LABEL
>        ENCODING CP437
>        TYPE truetype
>        FONT verdana
>        SIZE 8
>      END
>    END
>  END
>
>  LAYER
>    NAME "Sverige"
>    STATUS ON
>    TILEINDEX "D:\data\Mapdata\gsd\Svekra\idx"
>    TYPE RASTER
>    MAXSCALE 1500000
>    MINSCALE 250000
>  END
>
>  LAYER
>    NAME "Översiktskartan"
>    STATUS ON
>    TILEINDEX "D:\data\Mapdata\gsd\Overskra\idx"
>    TYPE RASTER
>    MAXSCALE 250000
>    MINSCALE 75000
>  END
>
>  LAYER
>    NAME "Vägkartan"
>    STATUS ON
>    TILEINDEX "D:\data\Mapdata\gsd\Vagkra\idx"
>    TYPE RASTER
>    MAXSCALE 75000
>    MINSCALE 25000
>  END
>
>  LAYER
>    NAME "Terrängkartan"
>    STATUS ON
>    TILEINDEX "D:\data\Mapdata\gsd\Terrkra\idx"
>    TYPE RASTER
>    MAXSCALE 25000
>  END
>
>  LAYER
>    NAME "Tätortskartan"
>    STATUS ON
>    TILEINDEX "D:\data\Mapdata\gsd\Tatortra\idx"
>    TYPE RASTER
>    OFFSITE 255 255 255
>    MAXSCALE 10000
>  END
> END # Map File
> +++++++++++++++++++++++++++
>
> /Johan
>
> ___________________________________
>
>
> Johan Hallgren
>
>
> Logica
> Pelle Bergs backe 3
> Box 1938, 791 19 Falun
> Tel (och mobil): 023-547 46 (int: +46-2354746)
> johan.hallgren at logica.com
> http://www.logica.se
>
> -----Original Message-----
> From: Tamas Szekeres [mailto:szekerest at gmail.com]
> Sent: den 13 augusti 2008 15:36
> To: Hallgren, Johan
> Cc: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Memoryproblem
>
> Johan,
>
> I wonder if this was a Win 2003 issue, since all of the windows builder are running on Win 2003 at the buildbot and the build process includes testing the getBytes function.
>
> How is your mapfile looking like? Which mapserver version are you testing with.
>
>
> Tamas
>
>
>
> 2008/8/13 Hallgren, Johan <johan.hallgren at logica.com>:
>> Hello Tamas
>>
>> I'm glad that you supports me here:)
>>
>> We are getting closer to the problem:)
>>
>> Your code (getbytes.exe) runs fine on my own pc, but when I move the code to the server the problem starts.
>>
>> I made a new project with your cs-file and named it getbytemap, but it's actually the same code as the getbytes.exe. The output below doesn't actually write the error but the "GetBytes:" is the first part och the exception message. I can guess that the memory already is corrupt. When I do the same with the debugger you can see the watch output below.
>>
>> One difference I have in mind compared to other environments I have used is that this server have more power. In the task manager there is eight CPUs.
>>
>> The problem is deterministic with the getbyte-code.
>>
>> Console output
>> +++++++++++++++++++++++++++++++++++
>> C:\temp>getbytemap.exe D:\apps\GMSAgent\MapFiles\gims.map
>> c:\temp\t.png Drawing map: 'GIMS' using imageObj.getBytes
>> GetBytes:
>>
>> C:\temp>getbytemap.exe D:\apps\GMSAgent\MapFiles\gims.map
>> c:\temp\t.png Drawing map: 'GIMS' using imageObj.getBytes Drawing map:
>> 'GIMS' using imageObj.write
>> GetBytes:
>>
>> C:\temp>getbytemap.exe D:\apps\GMSAgent\MapFiles\gims.map
>> c:\temp\t.png Drawing map: 'GIMS' using imageObj.getBytes
>> GetBytes:
>>
>> C:\temp>getbytemap.exe D:\apps\GMSAgent\MapFiles\gims.map
>> c:\temp\t.png Drawing map: 'GIMS' using imageObj.getBytes
>> GetBytes:
>>
>> C:\temp>getbytemap.exe D:\apps\GMSAgent\MapFiles\gims.map
>> c:\temp\t.png Drawing map: 'GIMS' using imageObj.getBytes
>> GetBytes:
>> +++++++++++++++++++++++++++++++++++
>>
>> Watch output
>> +++++++++++++++++++++++++++++++++++
>> ex.Message      "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."        string
>> +++++++++++++++++++++++++++++++++++
>>
>> /Johan
>>
>> ___________________________________
>>
>>
>> Johan Hallgren
>>
>>
>> Logica
>> Pelle Bergs backe 3
>> Box 1938, 791 19 Falun
>> Tel (och mobil): 023-547 46 (int: +46-2354746)
>> johan.hallgren at logica.com http://www.logica.se
>>
>> -----Original Message-----
>> From: Tamas Szekeres [mailto:szekerest at gmail.com]
>> Sent: den 12 augusti 2008 16:48
>> To: Hallgren, Johan
>> Cc: mapserver-users at lists.osgeo.org
>> Subject: Re: [mapserver-users] Memoryproblem
>>
>> Johan,
>>
>> I haven't run into this problem yet. Do you able to run the getbytes console application in the /csharp directory?
>> Is this issue deterministic or random? Do you have an example to reproduce it?
>>
>> Best regards,
>>
>> Tamas
>>
>>
>> 2008/8/12 Hallgren, Johan <johan.hallgren at logica.com>:
>>> Hello
>>>
>>>
>>>
>>> I have a major problem when using imgMapObj.getBytes().
>>>
>>> The memory will be corrupt. The problem doesn't occur when using the
>>> save function.  I have not seen the problem on other servers so the
>>> problem seams to be related to a specific server (Windows Server 2003 standard edition).
>>>
>>> Error msg
>>>
>>> ++++++++++++++++++++++
>>>
>>> Attempted to read or write protected memory. This is often an
>>> indication that other memory is corrupt.
>>>
>>>    at OSGeo.MapServer.mapscriptPINVOKE.imageObj_getBytes(HandleRef
>>> jarg1, SWIGByteArrayDelegate jarg2)
>>>    at OSGeo.MapServer.imageObj.getBytes(SWIGByteArrayDelegate callback)
>>>    at OSGeo.MapServer.imageObj.getBytes()
>>>    at WMData.GIS.GMSAgent_WP.Libs.MapEngine.Get_Image(XmlDocument
>>> xmlDoc, Boolean bRetImage) in
>>> C:\Project\applications\GMS\GMSAgent_WP\Libs\MapEngine.cs:line 298
>>> ++++++++++++++++++++++
>>>
>>> I use mapserver in c# and I have version 5.2.0.
>>>
>>>
>>>
>>> /Johan
>>>
>>> Johan Hallgren
>>>
>>> Logica
>>> Pelle Bergs backe 3
>>> Box 1938, 791 19 Falun
>>> Tel (och mobil): 023-547 46 (int: +46-2354746)
>>> johan.hallgren at logica.com http://www.logica.se
>>>
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>>
>>
>>
>
>



More information about the MapServer-users mailing list