tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rohan Padhye (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TIKA-2746) ParsingReader#throwable is not shared but not volatile
Date Wed, 03 Oct 2018 07:22:00 GMT
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}}


This message was sent by Atlassian JIRA

View raw message