On 18/12/16 21:20, Andrea Aime wrote: > On Sat, Dec 17, 2016 at 11:31 PM, Ben Caradoc-Davies <b...@transient.nz> > wrote: >> 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. > > Ouch... that is evil.... good job locating the cause!
Yes: finalizers are the gift that keep on giving. :-) >> 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. > > I'm all in to merge the fix. +1 Merged on master and cherry-picked onto 16.x and 15.x. I also found one unrelated open pull request (#1372) that failed on this and restarted its Travis CI build. > Thinking out loud, the logger keeps on being shared with other objects from > content data store > subclass, that might still be in the finalizer queue, those can still be > finalized while the test is running and > cause the log warning count to go up and break the test. > It is however probably just theoretical, as JDBCDataStore logs at SEVERE > level on finalize, and I don't see any > ready made way to force the code into using a new fresh logger... a small > change to ContentDataStore to > allow a subclass to instantiate its own logger would be needed. Yes, at the moment the transaction test only uses WARNING so is unlikely to be affected, but future improvements to ContentDataStore might add some WARNING in the finalizer and bring us a new rare and hard to reproduce intermittent failure. :-/ The other question is, which test is leaking an undisposed data store? There was a big cleanup in the other tests in this module in August (thanks!). No good deed goes unpunished. Hard to locate, and the transaction test should be more defensive, as it is now. Kind regards, -- 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