[
https://issues.apache.org/jira/browse/OAK-4824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15504275#comment-15504275
]
Alex Parvulescu commented on OAK-4824:
--------------------------------------
bq. This is a regression introduced with OAK-4746: the method
TarWriter.createNextGeneration() seems over eagerly synchronized.
right. looks bad. the issue is with accessing the {{access}} var which seems to
always be protected by a lock on the {{TarWriter}} itself. should we wrap only
the {{if (access == null)}} check in a {{synchronized (this)}} block?
> Deadlock in TarWriter
> ---------------------
>
> Key: OAK-4824
> URL: https://issues.apache.org/jira/browse/OAK-4824
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: segment-tar
> Reporter: Michael Dürig
> Priority: Critical
> Labels: deadlock, resilience, threading
> Fix For: Segment Tar 0.0.14
>
>
> There is the potential for a deadlock between concurrent calls to
> {{TarWriter#createNextGeneration()}} and {{TarWriter#flush()}}: both methods
> try to acquire a lock on this and another lock on {{TarWriter.file}} but in
> different order. I observed the deadlock when running
> {{CompactionAndCleanupIT.randomAccessFileConcurrentReadAndLength()}}.
> This is a regression introduced with OAK-4746: the method
> {{TarWriter.createNextGeneration()}} seems over eagerly synchronized. I would
> argue that we could drop synchronization for that method entirely as the part
> after the call to {{close()}} will in any case only ever be executed once by
> a single thread. All other threads will fail with an
> {{IllegalStateException}}).
> [~alexparvulescu], WDYT?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)