[Geoserver-users] IllegalMonitorStateException when Configuring Directory of Spatial Files

Hi,

I'm trying to load a directory of shapefiles using the WAR version of Geoserver 1.7.3 with tomcat. I can load individual shapfiles from the directory but when I try to load the whole directory the web console returns an error (Null) and I find an IllegalMonitorStateException in the Geoserver log file (included below).

Has anybody run across this before? I know that loading a directory is new with this release, perhaps it has issues with shapefiles?

Greg

2009-04-07 15:15:58,808 WARN [geoserver.action] - Unable to fetch a list of FeatureType names from datastore.
java.lang.IllegalMonitorStateException
  at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:363)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1253)
  at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:745)
  at org.geotools.data.directory.DirectoryTypeCache.getTypeNames(DirectoryTypeCache.java:147)
  at org.geotools.data.directory.DirectoryDataStore.getTypeNames(DirectoryDataStore.java:101)
  at org.vfny.geoserver.util.DataStoreUtils.getDataStore(DataStoreUtils.java:80)
  at org.vfny.geoserver.util.DataStoreUtils.acquireDataStore(DataStoreUtils.java:59)
  at org.vfny.geoserver.action.data.DataDataStoresEditorAction.execute(DataDataStoresEditorAction.java:147)
  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:647)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
  at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
  at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
  at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
  at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
  at java.lang.Thread.run(Thread.java:619)

--
--------------------------------------------------------------------
Gregory Yetman
Senior Staff Associate
Center for International Earth Science Information Network (CIESIN)
Columbia University
URL: http://www.ciesin.columbia.edu/
e-mail: gyetman (at) ciesin.columbia.edu
tel: (845) 365-8982
--------------------------------------------------------------------

Gregory Yetman ha scritto:

Hi,

I'm trying to load a directory of shapefiles using the WAR version of Geoserver 1.7.3 with tomcat. I can load individual shapfiles from the directory but when I try to load the whole directory the web console returns an error (Null) and I find an IllegalMonitorStateException in the Geoserver log file (included below).

Has anybody run across this before? I know that loading a directory is new with this release, perhaps it has issues with shapefiles?

Both me and Justin tried to reproduce the issue, failing to do so.
I tried with GeoServer installer and with the .war in Tomcat,
under Windows XP, with JDK 1.6, and I could not reproduce
the issue. I know Justin tried on OSX.

I looked at the code and this exception might be happening
if an exception occurs while trying to determine which shapefiles
are available in the directory. In that case the real exception
might be masked by this one.
I made a "blind patch" since I cannot reproduce the issue, so I
don't know if the patch is any effective.
Can you check the nightly build starting Apr 9? (today's one
was built before I could commit the patch):
http://gridlock.openplans.org/geoserver/1.7.x/

What I expect to see is a different kind of exception, one
relating to the inability to open one of your shapefiles.
At least that one should be more informative and allow us to
dig deeper on the real causes of this problem.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Andrea,

I went back and loaded the shapefiles one at a time. For a large point shapefile (300,000+ records) I get a sensible error via the web administration tool: Java heap space. The geoserver log ends with java.lang.OutOfMemoryError: Java heap space.

I may tweak the memory allocation but it probably make more sense to load a layer this large into postGIS. I also need to look into scale-dependent rendering for this many points.

Thanks,

Greg

Andrea Aime wrote:

Gregory Yetman ha scritto:

Hi,

I'm trying to load a directory of shapefiles using the WAR version of Geoserver 1.7.3 with tomcat. I can load individual shapfiles from the directory but when I try to load the whole directory the web console returns an error (Null) and I find an IllegalMonitorStateException in the Geoserver log file (included below).

Has anybody run across this before? I know that loading a directory is new with this release, perhaps it has issues with shapefiles?

Both me and Justin tried to reproduce the issue, failing to do so.
I tried with GeoServer installer and with the .war in Tomcat,
under Windows XP, with JDK 1.6, and I could not reproduce
the issue. I know Justin tried on OSX.

I looked at the code and this exception might be happening
if an exception occurs while trying to determine which shapefiles
are available in the directory. In that case the real exception
might be masked by this one.
I made a "blind patch" since I cannot reproduce the issue, so I
don't know if the patch is any effective.
Can you check the nightly build starting Apr 9? (today's one
was built before I could commit the patch):
http://gridlock.openplans.org/geoserver/1.7.x/

What I expect to see is a different kind of exception, one
relating to the inability to open one of your shapefiles.
At least that one should be more informative and allow us to
dig deeper on the real causes of this problem.

Cheers
Andrea

--
--------------------------------------------------------------------
Gregory Yetman
Senior Staff Associate
Center for International Earth Science Information Network (CIESIN)
Columbia University
URL: http://www.ciesin.columbia.edu/
e-mail: gyetman (at) ciesin.columbia.edu
tel: (845) 365-8982
--------------------------------------------------------------------

Gregory Yetman ha scritto:

Hi Andrea,

I went back and loaded the shapefiles one at a time. For a large point shapefile (300,000+ records) I get a sensible error via the web administration tool: Java heap space. The geoserver log ends with java.lang.OutOfMemoryError: Java heap space.

Ah, there you go. GeoServer is trying to create a spatial index
for that file but failing to do so because we lack a memory
efficient algorithm. I noted the problem time ago, but it's definitely
not something that can be tackled in the spare time:
http://jira.codehaus.org/browse/GEOS-1570

As a workaround you can install FWTools/OGR and use the shptree
command line utility, it will generate a GeoServer compatible
spatial index using a more memory efficient algorithm.

I may tweak the memory allocation but it probably make more sense to load a layer this large into postGIS. I also need to look into scale-dependent rendering for this many points.

Yeah. Which probably means you need to start drawing the
points at a certain scale and/or start drawing them progressively
using a classification attribute to start showing only the
most important at a certain scale, and adding less important
ones as you zoom in. In this case I would very much recommend
using PostGIS plus a spatial index and a normal index on
the classification attribute

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.