Hi, I'm trying to repeatedly update a feature in one of the resources using Ajax Java Viewer and custom Java code. After about 10-20min, the Mapguide server will reach 200MB memory usage and fail, throwing the following exception:
<2010-12-10T22:44:48> 3624 Ajax Viewer 127.0.0.1 Anonymous Error: Cannot create any more connections to the OSGeo.SHP FDO provider. StackTrace: - MgFeatureServiceHandler.ProcessOperation() line 83 file c:\osgeo\mapguide_21\mgdev\server\src\services\feature\FeatureServiceHandler.cpp - MgOpUpdateFeatures.Execute() line 111 file c:\osgeo\mapguide_21\mgdev\server\src\services\feature\OpUpdateFeatures.cpp - MgServerUpdateFeatures.UpdateFeatures() line 128 file c:\osgeo\mapguide_21\mgdev\server\src\services\feature\ServerUpdateFeatures.cpp - MgFdoConnectionManager.Open() line 259 file c:\osgeo\mapguide_21\mgdev\server\src\common\manager\FdoConnectionManager.cpp Looks like it runs out of connections to the feature service. I read some previous messages related to this issue,and the suggestion was to use Dispose() on all services and resources when done in one iteration. However, I can't find this method in the Java API for services or resourceIdentifiers. Below is my test code. It is trying to update the Name attribute of the Park resource to a value of "nowa3". this jsp page will be called repeatedly from UI: <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page import="org.osgeo.mapguide.*" %> <%@ page import="java.util.*" %> <%@ page import="java.io.*" %> <%@ page import="java.text.*" %> <%@ page import="javax.servlet.jsp.*" %> <%@ page import="javax.servlet.http.*" %> <%@ include file ="utilityfunctions.jsp" %> <%! String mapName = ""; String sessionId = ""; String selText = ""; boolean queryInfo; %> <% System.out.println("In dynamic update.\n"); response.setContentType("text/xml; charset=UTF-8"); request.setCharacterEncoding("UTF-8"); mapName = sessionId = selText = ""; queryInfo = false; //fetch the parameters for this request // //GetRequestParameters(request); mapName="basemap"; sessionId = request.getParameter("SESSION"); MgResourceIdentifier resId=null; try { System.out.println("here-4."); InitializeWebTier(); System.out.println("here-3."); MgUserInformation cred = new MgUserInformation(sessionId); cred.SetClientIp(GetClientIp(request)); cred.SetClientAgent(GetClientAgent()); System.out.println("here-2."); //connect to the site and get an instance of the resource service // MgSiteConnection site = new MgSiteConnection(); site.Open(cred); MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService); MgFeatureService featureService = (MgFeatureService)site.CreateService(MgServiceType.FeatureService); System.out.println("here-1."); //load the map runtime state // MgMap map = new MgMap(); map.Open(resourceSrvc, mapName); System.out.println("here0."); resId = new MgResourceIdentifier("Library://test/Data/Park.FeatureSource"); String filter = "Name like '%'" ; System.out.println("here."); MgFeatureCommandCollection commands = new MgFeatureCommandCollection(); MgPropertyCollection properties = new MgPropertyCollection(); String name = "nowa3"; properties.Add(new MgStringProperty("Name",name )); MgUpdateFeatures updateCommandRed = new MgUpdateFeatures("Park", properties, filter); commands.Add(updateCommandRed); //exceute commands if (commands.GetCount() >=1 ) { System.out.println("Issueing commands."); ReleaseReader(featureService.UpdateFeatures(resId, commands, false), commands); //featureService.UpdateFeatures(resId, commands, false); } System.out.println("here2."); //Now test if name has changed: MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions(); queryOptions.SetFilter(filter); System.out.println("here3."); MgFeatureReader featureReader = featureService.SelectFeatures(resId, "Park", queryOptions); System.out.println("here4."); int i = 0; while (featureReader.ReadNext()) { i++; int propCount = featureReader.GetPropertyCount(); for(int j=0; j<propCount; j++) { String propertyName = featureReader.GetPropertyName(j); System.out.println("prop " + propertyName + ", type=" + featureReader.GetPropertyType(propertyName)); } String newname = featureReader.GetString("Name"); System.out.println("Name=" + newname); //String id = featureReader.GetString("Id"); // out.write("Name after changing:" + newname); // out.write("Id :" + id); } System.out.println("here5."); //featureService.Dispose(); } catch (Exception ex) { ex.printStackTrace(); } finally { //resId.Dispose(); } %> Any help is apprecated. I am using Mapguide 2.1.0 Thanks. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mapguide-JavaAjaxViewer-Update-Features-Memory-Leak-tp5833542p5833542.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users