You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Rohan Padhye (JIRA)" <ji...@apache.org> on 2018/10/03 07:22:00 UTC
[jira] [Created] (TIKA-2746) ParsingReader#throwable is not shared
but not volatile
Rohan Padhye created TIKA-2746:
----------------------------------
Summary: ParsingReader#throwable is not shared but not volatile
Key: TIKA-2746
URL: https://issues.apache.org/jira/browse/TIKA-2746
Project: Tika
Issue Type: Bug
Components: core
Affects Versions: 1.19
Reporter: Rohan Padhye
The field {{throwable}} in {{org.apache.tika.parser.ParsingReader}} is modified by the background worker thread (in {{ParsingTask.run}}) and read by the reader thread (in {{ParsingReader.read}}). However, the field is not {{volatile}}, and no locks are used to protect its access, which means that there is no guarantee about if and when the update to {{throwable}} by the worker thread will be visible to the reader thread.
This can technically lead to data races, stale reads, and a slew of other non-deterministic behavior if the content handler throws an exception while parsing.
As a side note: the {{throwable}} field is marked as transient. I do not see why that is the case, given that the reader is not serializable. Is this just a typo from an intended {{volatile}} modifier?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)