FAQ
Read lock must be released before acquiring a write lock
--------------------------------------------------------

Key: HDFS-2103
URL: https://issues.apache.org/jira/browse/HDFS-2103
Project: Hadoop HDFS
Issue Type: Bug
Affects Versions: 0.23.0
Reporter: Bharath Mundlapudi
Assignee: Bharath Mundlapudi
Fix For: 0.23.0


In FSNamesystem.getBlockLocationsUpdateTimes function, we have the following code:

{code}
for (int attempt = 0; attempt < 2; attempt++) {
if (attempt == 0) { // first attempt is with readlock
readLock();
} else { // second attempt is with write lock
writeLock(); // writelock is needed to set accesstime
}

...

if (attempt == 0) {
continue;
}
{code}

In the above code, readLock is acquired in attempt 0 and if the execution enters in the continue block, then it tries to acquire writeLock before releasing the readLock.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Search Discussions

  • Bharath Mundlapudi (JIRA) at Jun 23, 2011 at 9:13 am
    [ https://issues.apache.org/jira/browse/HDFS-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Bharath Mundlapudi resolved HDFS-2103.
    --------------------------------------

    Resolution: Not A Problem

    Didn't notice the finally block, where read lock is released. I am closing this Jira.
    Read lock must be released before acquiring a write lock
    --------------------------------------------------------

    Key: HDFS-2103
    URL: https://issues.apache.org/jira/browse/HDFS-2103
    Project: Hadoop HDFS
    Issue Type: Bug
    Affects Versions: 0.23.0
    Reporter: Bharath Mundlapudi
    Assignee: Bharath Mundlapudi
    Fix For: 0.23.0


    In FSNamesystem.getBlockLocationsUpdateTimes function, we have the following code:
    {code}
    for (int attempt = 0; attempt < 2; attempt++) {
    if (attempt == 0) { // first attempt is with readlock
    readLock();
    } else { // second attempt is with write lock
    writeLock(); // writelock is needed to set accesstime
    }
    ...
    if (attempt == 0) {
    continue;
    }
    {code}
    In the above code, readLock is acquired in attempt 0 and if the execution enters in the continue block, then it tries to acquire writeLock before releasing the readLock.
    --
    This message is automatically generated by JIRA.
    For more information on JIRA, see: http://www.atlassian.com/software/jira

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphdfs-dev @
categorieshadoop
postedJun 23, '11 at 9:11a
activeJun 23, '11 at 9:13a
posts2
users1
websitehadoop.apache.org...
irc#hadoop

1 user in discussion

Bharath Mundlapudi (JIRA): 2 posts

People

Translate

site design / logo © 2023 Grokbase