hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Krogen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-14048) DFSOutputStream close() throws exception on subsequent call after DataNode restart
Date Fri, 02 Nov 2018 14:32:00 GMT
Erik Krogen created HDFS-14048:

             Summary: DFSOutputStream close() throws exception on subsequent call after DataNode
                 Key: HDFS-14048
                 URL: https://issues.apache.org/jira/browse/HDFS-14048
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: hdfs-client
    Affects Versions: 2.3.0
            Reporter: Erik Krogen
            Assignee: Erik Krogen

We recently discovered an issue in which, during a rolling upgrade, some jobs were failing
with exceptions like (sadly this is the whole stack trace):
java.io.IOException: A datanode is restarting: DatanodeInfoWithStorage[,BP-XXXX,DISK]
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer$ResponseProcessor.run(DFSOutputStream.java:877)
with an earlier statement in the log like:
INFO [main] org.apache.hadoop.hdfs.DFSClient: A datanode is restarting: DatanodeInfoWithStorage[,BP-XXXX,DISK]

Strangely we did not see any other logs about the {{DFSOutputStream}} failing after waiting
for the DataNode restart. We eventually realized that in some cases {{DFSOutputStream#close()}}
may be called more than once, and that if so, the {{IOException}} above is thrown on the _second_
call to {{close()}} (this is even with HDFS-5335; prior to this it would have been thrown
on all calls to {{close()}} besides the first).

The problem is that in {{DataStreamer#createBlockOutputStream()}}, after the new output stream
is created, it resets the error states:
        // remove all restarting nodes from failed nodes list
But it forgets to clear {{lastException}}. When {{DFSOutputStream#closeImpl()}} is called
a second time, this block is triggered:
    if (isClosed()) {
      LOG.debug("Closing an already closed stream. [Stream:{}, streamer:{}]",
          closed, getStreamer().streamerClosed());
      try {
The second time, {{isClosed()}} is true, so the exception checking occurs and the "Datanode
is restarting" exception is thrown even though the stream has already been successfully closed.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org

View raw message