hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo Nicholas Sze (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-7276) Limit the number of byte arrays used by DFSOutputStream
Date Fri, 31 Oct 2014 23:49:34 GMT

    [ https://issues.apache.org/jira/browse/HDFS-7276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14192767#comment-14192767

Tsz Wo Nicholas Sze commented on HDFS-7276:

> I don't see any case where this would deadlock if we used notify rather than notifyAll.

Here is a deadlock example. Suppose the limit=n, the allocation count=n, T1 ... Tn are threads
allocated a buffer but not yet released.
# Two new threads Tn+1 and Tn+2 call allocate, both have to wait.
# T1 releases a buffer; count becomes n-1; T1 calls notify but not notifyAll; only Tn+1 wakes
# Before Tn+1 is scheduled to run, T2 ... Tn are executed and release a buffer; they won't
call notify since count < limit; count eventually becomes 0.
# Now, Tn+1 is scheduled to run and allocates a buffer; count becomes 1
# Tn+1 comes back and releases the buffer, it also won't call notify since count < limit;
count becomes 0
# Tn+2 will wait forever if there is no more allocate calls.

> Limit the number of byte arrays used by DFSOutputStream
> -------------------------------------------------------
>                 Key: HDFS-7276
>                 URL: https://issues.apache.org/jira/browse/HDFS-7276
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: hdfs-client
>            Reporter: Tsz Wo Nicholas Sze
>            Assignee: Tsz Wo Nicholas Sze
>         Attachments: h7276_20141021.patch, h7276_20141022.patch, h7276_20141023.patch,
h7276_20141024.patch, h7276_20141027.patch, h7276_20141027b.patch, h7276_20141028.patch, h7276_20141029.patch,
h7276_20141029b.patch, h7276_20141030.patch, h7276_20141031.patch
> When there are a lot of DFSOutputStream's writing concurrently, the number of outstanding
packets could be large.  The byte arrays created by those packets could occupy a lot of memory.

This message was sent by Atlassian JIRA

View raw message