[Geoserver-devel] Odd random failure in GeoServer build

Hi,
every now and then the build fails with this exception:

java.lang.NullPointerException
	at org.geoserver.catalog.impl.DefaultCatalogFacade.getResourceByName(DefaultCatalogFacade.java:299)
	at org.geoserver.catalog.impl.CatalogImpl.getResourceByName(CatalogImpl.java:469)
	at org.geoserver.catalog.impl.CatalogImpl.validate(CatalogImpl.java:408)
	at org.geoserver.catalog.impl.CatalogImpl.add(CatalogImpl.java:380)
	at org.geoserver.catalog.impl.CatalogImplTest$LayerAddRunner.runInternal(CatalogImplTest.java:1890)
	at org.geoserver.catalog.impl.RunnerBase.run(RunnerBase.java:30)
	at java.lang.Thread.run(Thread.java:722)

I see this on the OpenJDK7 server, but afaik I spotted it at least once on the main build server as well.

The issue seems to be related to the fact the DefaultCatalogFacade is not thread safe, and of course the test
in question is not using the config locks preventing concurrent access.

For the moment I’ve fixed it by checking for null values in the List lookup(Class clazz, MultiHashMap map) method,
but it would be better if we had a concurrent data structure there.
There is a problem though, in that code we are using a MultiMap, and afaik there are no concurrent multimap
implementations around.

Anyone knows of a good solution?

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Sat, Nov 17, 2012 at 7:58 PM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

There is a problem though, in that code we are using a MultiMap, and afaik
there are no concurrent multimap
implementations around.

Anyone knows of a good solution?

I've did some googling, here's what I've found:

http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multimaps.html#synchronizedMultimap(com.google.common.collect.Multimap)

A question by Viktor Klang (Akka creator)
http://stackoverflow.com/questions/3635292/high-performance-concurrent-multimap-java-scala
and his MultiMap implementation in Scala:
https://github.com/akka/akka/blob/release-1.3.1/akka-actor/src/main/scala/akka/actor/ActorRegistry.scala#L281

And a blog post I still didn't have time to read:
http://dhruba.name/2011/06/11/concurrency-pattern-concurrent-multimaps-in-java/

:slight_smile:

--
Davide Savazzi