[
https://issues.apache.org/jira/browse/GROOVY-6934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles closed GROOVY-6934.
-------------------------------
Resolution: Information Provided
> JsonSlurper in 2.3 returns LazyMap which is not thread safe for multiple reads
> ------------------------------------------------------------------------------
>
> Key: GROOVY-6934
> URL: https://issues.apache.org/jira/browse/GROOVY-6934
> Project: Groovy
> Issue Type: Bug
> Components: JSON
> Affects Versions: 2.3.4
> Environment: Linux
> Reporter: Stefanos Zachariadis
> Priority: Critical
> Attachments: MapBug.groovy
>
>
> 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
--
This message was sent by Atlassian Jira
(v8.20.10#820010)