Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Information Provided
-
2.3.4
-
None
-
None
-
Linux
Description
We recently upgraded one of our systems from Groovy 2.1 to Groovy 2.3. This went mostly without any issues which was great. We did have one issue which caused us a bit of grief. It seems that groovy 2.3 changed the type of map that the JsonSlurper returns from the default HashMap to a LazyMap. Looking at the implementation of LazyMap, it's not thread safe for multiple reads. We are seeing multiple null pointer exceptions in our logs, which result from the fact that the map is lazily constructed by multiple threads, and the first thread to finish nulls the keys and values. (There are also other concurrency bugs there).
I am attaching a test case that demonstrates this. It works fine in groovy 2.2 and 2.1, but gets a null pointer in 2.3.
I'd consider this a very serious breaking change. Only reference of this change I can find is here:
http://marc.info/?t=139063532100001&r=1&w=2
While we can about concurrency semantics, I would expect data that was read of the wire to be readable by multiple threads, and groovy up to version 2.2 did offer this behaviour.
Thank you,
Stefanos Zachariadis
LMAX
Attachments
Attachments
Issue Links
- is related to
-
GROOVY-7532 Allow converting JsonParserLax into a roughly normal Groovy map
- Open