We're updating the issue view to help you get more done. 

Intermittent failure of FileUtils.deleteDirectory in SystemTestData.tearDown

Description

We often see failures of FileUtils.deleteDirectory in SystemTestData.tearDown in builds.

http://ares.boundlessgeo.com/jenkins/job/geoserver-master/4638/consoleText

1 2 3 4 5 org.geoserver.wfs.v2_0.GetFeatureJoinTest Time elapsed: 56 sec <<< ERROR! java.io.IOException: Unable to delete directory ./target/default6619173959064498977data. at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1337) at org.geoserver.data.test.SystemTestData.tearDown(SystemTestData.java:1026) at org.geoserver.test.GeoServerBaseTestSupport.doTearDownClass(GeoServerBaseTestSupport.java:206)

http://ares.boundlessgeo.com/jenkins/job/geoserver-master/4672/consoleText

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.075 sec <<< FAILURE! org.geoserver.wps.web.ProcessStatusPageTest Time elapsed: 6072 sec <<< ERROR! java.io.IOException: Unable to delete directory ./target/default5475053532950449796data/temp/wps/e4fa42c3-fd2a-48f0-ae6b-d83fb7ec34d6. at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1337) at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1910) at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1399) at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1331) at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1910) at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1399) at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1331) at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1910) at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1399) at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1331) at org.geoserver.data.test.SystemTestData.tearDown(SystemTestData.java:1026) at org.geoserver.test.GeoServerBaseTestSupport.doTearDownClass(GeoServerBaseTestSupport.java:206)

http://ares.boundlessgeo.com/jenkins/job/geoserver-master/4674/consoleText

1 2 3 4 5 6 Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.975 sec <<< FAILURE! org.geoserver.netcdf.NetCDFGetFeatureInfoTest Time elapsed: 7972 sec <<< ERROR! java.io.IOException: Unable to delete directory ./target/default8989027234526976461data. at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1337) at org.geoserver.data.test.SystemTestData.tearDown(SystemTestData.java:1026) at org.geoserver.test.GeoServerBaseTestSupport.doTearDownClass(GeoServerBaseTestSupport.java:206)

These failures are hard to reproduce locally, but running org.geoserver.wfs.v2_0.GetFeatureJoinTest in Eclipse reveals files like src/wfs/target/default7740998516718894422data/foo.2.log.db that are not cleaned. This indicates that data stores (in this case H2) are still writing to the data directory location and have not been disposed. Adding a breakpoint shows that CatalogImpl.dispose{} is never hit. Furthermore GeoServerImpl.dispose() is never called. The fix is to add a call to GeoServer.dispose() in GeoServerSystemTestSupport.destroyGeoServer() to ensure that all data stores are disposed before the data directory is removed. This change prevents the stale H2 cruft foo.2.log.db from being left behind when running org.geoserver.wfs.v2_0.GetFeatureJoinTest in Eclipse. It also causes new GWCIntegrationTest and GWCDataSecurityTest failures, under investigation.

Environment

None

Status

Assignee

Ben Caradoc-Davies

Reporter

Ben Caradoc-Davies

Triage

None

Fix versions

Affects versions

2.12-beta

Components

Priority

Medium