John Doe created HADOOP-19916:
---------------------------------
Summary: AbfsListStatusRemoteIterator may hang indefinitely due to
missing volatile on isIterationComplete
Key: HADOOP-19916
URL: https://issues.apache.org/jira/browse/HADOOP-19916
Project: Hadoop Common
Issue Type: Bug
Affects Versions: 3.4.1
Reporter: John Doe
{{AbfsListStatusRemoteIterator.isIterationComplete}} is a non-volatile boolean
shared between the main thread and an async ForkJoinPool thread.
Due to the absence of {{{}volatile{}}}, the JIT compiler may legally hoist the
read of {{isIterationComplete}} in {{{}getNextIterator(){}}}'s polling loop
into a register, causing the main thread to spin indefinitely even after
listing has completed.
The async thread writes {{isIterationComplete = true}} inside
{{addNextBatchIteratorToQueue()}} (a {{synchronized}} method). However, the
main thread reads {{isIterationComplete}} in {{{}getNextIterator(){}}}'s
{{{}while{}}}-loop condition without holding any lock, because
{{fetchBatchesAsync()}} contains an unsynchronized fast-path check ({{{}if
(isAsyncInProgress || isIterationComplete){}}}) that returns early when
{{{}isAsyncInProgress == true{}}}, bypassing the {{synchronized(this)}} block
entirely.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]