Note that there are some explanatory texts on larger screens.

plurals
  1. POHadoop FileSystem closed exception when doing BufferedReader.close()
    primarykey
    data
    text
    <p>From within the Reduce setup method,I am trying to close a <code>BufferedReader</code> object and getting a <code>FileSystem</code> closed exception. It does not happen all the time. This is the piece of code I used to create the <code>BufferedReader</code>.</p> <pre><code> String fileName = &lt;some HDFS file path&gt; Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); Path hdfsPath = new Path(filename); FSDataInputStream in = fs.open(hdfsPath); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); </code></pre> <p>I read contents from the bufferedReader and once all the reading is done, I close it. </p> <p>This is the piece of code that reads it</p> <pre><code>String line; while ((line = reader.readLine()) != null) { // Do something } </code></pre> <p>This the piece of code that closes the reader.</p> <pre><code> if (bufferedReader != null) { bufferedReader.close(); } </code></pre> <p>This is the stack trace for the exception that happens when I do a <code>bufferedReader.close()</code>.</p> <blockquote> <p>I, [2013-11-18T04:56:51.601135 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:565)</p> <p>I, [2013-11-18T04:56:51.601168 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at org.apache.hadoop.hdfs.DFSInputStream.close(DFSInputStream.java:522)</p> <p>I, [2013-11-18T04:56:51.601199 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at java.io.FilterInputStream.close(FilterInputStream.java:155)</p> <p>I, [2013-11-18T04:56:51.601230 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:358)</p> <p>I, [2013-11-18T04:56:51.601263 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:173)</p> <p>I, [2013-11-18T04:56:51.601356 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at java.io.InputStreamReader.close(InputStreamReader.java:182)</p> <p>I, [2013-11-18T04:56:51.601395 #25683] INFO -- : attempt_201310111840_142285_r_000009_0: at java.io.BufferedReader.close(BufferedReader.java:497)</p> </blockquote> <p>I am not sure why this exception is happening. This is not multithreaded and so, I do not expect there to be a race condition of any sort. Can you please help me understand.</p> <p>Thanks,</p> <p>Venk</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload