hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kan Zhang (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (HADOOP-5859) FindBugs : fix "wait() or sleep() with locks held" warnings in hdfs
Date Tue, 26 May 2009 18:25:45 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-5859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713180#action_12713180
] 

Kan Zhang edited comment on HADOOP-5859 at 5/26/09 11:24 AM:
-------------------------------------------------------------

> Unless the variable is declared as "volatile", right?

I just checked, the JDK6 implementation of LinkedList didn't declare the "size" variable volatile.
So Todd is right, a second thread may see a stale cached value (does anyone know how long
the value will be cached by a thread, I hope it's not forever :)). In any case, this is a
non-issue after my refactoring. In the refactored code, all accesses to dataQueue or ackQueue
are sync'ed on dataQueue lock. 

      was (Author: kzhang):
    > Unless the variable is declared as "volatile", right?

I just checked, the JDK6 implementation of LinkedList didn't declare the "size" variable volatile.
So Todd is right, a second thread may see a stale cached value (does anyone know how long
the value will be cached a thread, I hope it's not forever :). In any case, this is a non-issue
after my refactoring. In the refactored code, all accesses to dataQueue or ackQueue are sync'ed
on dataQueue lock. 
  
> FindBugs : fix "wait() or sleep() with locks held" warnings in hdfs
> -------------------------------------------------------------------
>
>                 Key: HADOOP-5859
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5859
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: dfs
>            Reporter: Kan Zhang
>            Assignee: Kan Zhang
>         Attachments: 5859-21.patch, 5859-22.patch, 5859-26.patch, 5859-4.patch, 5859-5.patch,
5859-8.patch
>
>
> This JIRA fixes the following warnings:
> SWL	org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.closeInternal() calls Thread.sleep()
with a lock held
> TLW	wait() with two locks held in org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.flushInternal()
> TLW	wait() with two locks held in org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.flushInternal()
> TLW	wait() with two locks held in org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.writeChunk(byte[],
int, int, byte[])

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message