Andrea, it looks like the problem was a race condition between the GC thread calling a finalizer for a data store leaked from another test and the stubbing setup for the test log handler, mediated by the shared ContentDataStore logger. Fix is to register the mock log handler only after stubbing is complete.
Pull request for master: https://github.com/geotools/geotools/pull/1419 With the fix, running all gt-jdbc tests passed 100 trials in Maven and over 20 in Eclipse. If this looks OK, I can cherry-pick it onto 16.x and 15.x. Kind regards, Ben. On 18/12/16 09:00, Ben Caradoc-Davies wrote: > Andrea, > > I can repeat this intermittent failure by running all tests (only) for > this module in Maven and Eclipse: > https://osgeo-org.atlassian.net/browse/GEOT-5603 > > Kind regards, > Ben. > > On 22/11/16 04:51, Andrea Aime wrote: >> Hi, >> I keep on seen this error in pull request: >> >> SEVERE: There's code using JDBC based datastore and not disposing >> them. This may lead to temporary loss of database connections. Please >> make sure all data access code calls DataStore.dispose() before >> freeing all references to it >> Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.057 >> sec <<< FAILURE! - in org.geotools.jdbc.JDBCTransactionStateTest >> testSetTransactionNullWithExternalConnection(org.geotools.jdbc.JDBCTransactionStateTest) >> Time elapsed: 0.007 sec <<< ERROR! >> org.mockito.exceptions.misusing.UnfinishedStubbingException: >> Unfinished stubbing detected here: >> -> at >> org.geotools.jdbc.JDBCTransactionStateTest.setupLogHandler(JDBCTransactionStateTest.java:64) >> >> E.g. thenReturn() may be missing. >> Examples of correct stubbing: >> when(mock.isOk()).thenReturn(true); >> when(mock.isOk()).thenThrow(exception); >> doThrow(exception).when(mock).someVoidMethod(); >> Hints: >> 1. missing thenReturn() >> 2. although stubbed methods may return mocks, you cannot inline mock >> creation (mock()) call inside a thenReturn method (see issue 53) >> >> at >> org.geotools.jdbc.JDBCTransactionStateTest.setupLogHandler(JDBCTransactionStateTest.java:73) >> >> It is never related to the pull request itself, and I cannot reproduce it >> locally with either Oracle or OpenJDK (believe Jody tried to reproduce >> too and failed). >> >> I've cc'ed the original author, but really, is there anyone that knows or >> can guess why it's failing? >> >> Cheers >> Andrea >> >> >> >> ------------------------------------------------------------------------------ >> >> >> >> _______________________________________________ >> GeoTools-Devel mailing list >> GeoTools-Devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-devel >> > -- Ben Caradoc-Davies <b...@transient.nz> Director Transient Software Limited <http://transient.nz/> New Zealand ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel