Affects Version/s: 8.1
Fix Version/s: 8.3.1
Discussed on the mailing list "Possible data corruption in JavaBinCodec in Solr 8.3 during distributed update?"
In summary, after moving to 8.3 we had a consistent (but non-deterministic) set of failing tests where the data being sent in intranode requests was sometimes corrupted. For example if the well formed data was
'fieldName':"this is a long string"
The error we saw from Solr might be that
The change that indirectly caused to this issue to materialize was from
SOLR-13682 which meant that org.apache.solr.common.SolrInputDocument.writeMap(EntryWriter) would call org.apache.solr.common.SolrInputField.getValue() rather than org.apache.solr.common.SolrInputField.getRawValue() as it had before.
getRawValue for a string calls org.apache.solr.common.util.ByteArrayUtf8CharSequence._getStr() which in this context calls
JavaBinCodec has a CharArr, arr, which is modified in two different locations, but only one of which is protected with a synchronized block
getStringProvider() synchronizes on arr:
but _readStr() doesn't:
The two methods are called concurrently, but wheren't prior to
Adding a synchronized block into readStr() around the modification of _arr fixes the problem as far as I can see.
Also, the problem does not seem to occur when using the dynamic schema mode of autoCreateFields=true in the updateRequestProcessorChain.