[Geoserver-devel] [jira] Created: (GEOS-2611) Adding shapefile datastore causes java.lang.OutOfMemoryError: Java heap space

Adding shapefile datastore causes java.lang.OutOfMemoryError: Java heap space
-----------------------------------------------------------------------------

                 Key: GEOS-2611
                 URL: http://jira.codehaus.org/browse/GEOS-2611
             Project: GeoServer
          Issue Type: Bug
    Affects Versions: 1.7.0 , 1.7.2, 1.7.1
         Environment: Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Kernel 2.6.9-42.ELsmp #1 SMP i686
Intel Pentium 4 CPU 3.06GHz
2GB RAM
Java JDK 1.5.0u12
            Reporter: Paul
            Assignee: Andrea Aime

In GeoServer 1.7.0 and newer, I get a OutOfMemoryError when I try to add a shapefile datastore to the configuration. This same test worked with 1.6.5 and earlier versions. I go to DataStores and click "new", select "shapefile" and specify an ID, and on the next screen I specify the path to the file. I leave the charset at its default ISO-8859-1, and the spatial index and memory mapped buffer options are left off.

When I click the "submit" button, I wait for 20+ seconds without seeing any response. Then I see this error on the console:

form connection params { url=file:data/shapefile_geography/LOW_Lakes.shp, charset=ISO-8859-1}
05 Feb 18:24:42 WARN [geoserver.action] - Unable to fetch a list of FeatureType names from datastore.
java.lang.OutOfMemoryError: Java heap space
        at java.lang.String.<init>(String.java:208)
        at java.lang.StringBuilder.toString(StringBuilder.java:431)
        at org.geotools.data.shapefile.ShpFilesLocker.setTraceException(ShpFilesLocker.java:54)
        at org.geotools.data.shapefile.ShpFilesLocker.<init>(ShpFilesLocker.java:33)
        at org.geotools.data.shapefile.ShpFiles.unlockRead(ShpFiles.java:441)
        at org.geotools.data.shapefile.FileChannelDecorator.implCloseChannel(FileChannelDecorator.java:143)
        at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:97)
        at org.geotools.data.shapefile.shp.IndexFile.close(IndexFile.java:182)
        at org.geotools.index.quadtree.QuadTree.close(QuadTree.java:357)
        at org.geotools.data.shapefile.indexed.ShapeFileIndexer.buildQuadTree(ShapeFileIndexer.java:269)
        at org.geotools.data.shapefile.indexed.ShapeFileIndexer.index(ShapeFileIndexer.java:175)
        at org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.buildQuadTree(IndexedShapefileDataStore.java:978)
        at org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.createSpatialIndex(IndexedShapefileDataStore.java:218) at org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.<init>(IndexedShapefileDataStore.java:196)
        at org.geotools.data.shapefile.ShapefileDataStoreFactory.createDataStoreInstance(ShapefileDataStoreFactory.java:347)
        at org.geotools.data.shapefile.ShapefileDataStoreFactory.createDataStore(ShapefileDataStoreFactory.java:190)
        at org.geotools.data.shapefile.ShapefileDataStoreFactory.createDataStore(ShapefileDataStoreFactory.java:59)
        at org.vfny.geoserver.util.DataStoreUtils.getDataStore(DataStoreUtils.java:75)
        at org.vfny.geoserver.util.DataStoreUtils.acquireDataStore(DataStoreUtils.java:59)
        at org.vfny.geoserver.action.data.DataDataStoresEditorAction.execute(DataDataStoresEditorAction.java:135)
        at org.vfny.geoserver.action.ConfigAction.execute(ConfigAction.java:101)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
        at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)

I have tried running GeoServer using the default bin/startup.sh script. I've also tried using the following startup options:
   -server -Xms48m -Xmx256M
The error occurs in both cases.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira