[Geoserver-devel] GWC tests failing on Windows, race condition and suggested fix

Hi,
I’m still working on getting the build pass on Windows, and looking into a GWC test failure that seems legit:

00:23:57] Tests run: 47, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 264.757 sec <<< FAILURE!
[00:23:57] testAutomaticTruncationFeatureChange(org.geoserver.gwc.GWCIntegrationTest) Time elapsed: 34239 sec <<< FAILURE!
[00:23:57] java.lang.AssertionError:
[00:23:57] Expected: equalToIgnoringCase(“MISS”)
[00:23:57] but: was HIT
[00:23:57] at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
[00:23:57] at org.junit.Assert.assertThat(Assert.java:865)
[00:23:57] at org.junit.Assert.assertThat(Assert.java:832)
[00:23:57] at org.geoserver.gwc.GWCIntegrationTest.testAutomaticTruncationFeatureChange(GWCIntegrationTest.java:889)

I’ve checked the tests, it runs a WFS transaction and then expects to find a MISS requesting the affected area.
Which is legit per se, but looking at how the truncation happens, I’ve seen this path (links to relevant points in the stack):
https://github.com/geoserver/geoserver/blob/6e9e25c0c7cdda9ada9f33f8255130d3afc76801/src/gwc/src/main/java/org/geoserver/gwc/GWCTransactionListener.java#L117

https://github.com/geoserver/geoserver/blob/aac437b8d96710e92fde6e1f5f28860fce825cea/src/gwc/src/main/java/org/geoserver/gwc/GWC.java#L462

https://github.com/GeoWebCache/geowebcache/blob/12fac3240a38704b407cb44e26a94d5499c74af9/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateBboxRequest.java#L75

https://github.com/GeoWebCache/geowebcache/blob/fae88320e69f6b536f97ed879a86ad46867744ae/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java#L215

https://github.com/GeoWebCache/geowebcache/blob/fae88320e69f6b536f97ed879a86ad46867744ae/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java#L281

So it would seem the feature change triggers a truncate, but also that the truncate happens asynchronously, making the
test prone to random failures? (I’m guessing that on Windows thread scheduling is done in a different way, and makes this
issue easier to spot?

I’ve put toghether this tentative patch, but not sure if it might have other side effects (e.g., is there anything that would
schedule jobs in the breeder periodically, making it never be out of jobs?)
https://github.com/aaime/geoserver/commit/2526185590e1a9fc4eed6a3596517b06717482a1

On the bright side, with that patch I finally got a green build on AppVeyor:
https://ci.appveyor.com/project/aaime/geoserver/build/1.0.12

(worth noticing, it’s building GeoServer faster than Travis)

If this change is ok, we might be able to merge the windows build pull request and enable appveyor builds for GeoServer too:
https://github.com/geoserver/geoserver/pull/2983

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.