IOException: Filesystem closed exception when running oozie workflow
Asked Answered
P

3

11

We are running a workflow in oozie. It contains two actions: the first is a map reduce job that generates files in the hdfs and the second is a job that should copy the data in the files to a database.

Both parts are done successfully but oozie throws an exception at the end that marks it as a failed process.

This is the exception:

2014-05-20 17:29:32,242 ERROR org.apache.hadoop.security.UserGroupInformation:   PriviledgedActionException as:lpinsight (auth:SIMPLE) cause:java.io.IOException: Filesystem   closed
2014-05-20 17:29:32,243 WARN org.apache.hadoop.mapred.Child: Error running child
java.io.IOException: Filesystem closed
    at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:565)
    at org.apache.hadoop.hdfs.DFSInputStream.close(DFSInputStream.java:589)
    at java.io.FilterInputStream.close(FilterInputStream.java:155)
    at org.apache.hadoop.util.LineReader.close(LineReader.java:149)
    at org.apache.hadoop.mapred.LineRecordReader.close(LineRecordReader.java:243)
    at org.apache.hadoop.mapred.MapTask$TrackedRecordReader.close(MapTask.java:222)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:421)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at   org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408)
    at org.apache.hadoop.mapred.Child.main(Child.java:262)

2014-05-20 17:29:32,256 INFO org.apache.hadoop.mapred.Task: Runnning cleanup for the task

Any idea ?

Petie answered 21/5, 2014 at 9:28 Comment(0)
O
11

Use the below configuration while accessing file system.

Configuration conf = new Configuration();
conf.setBoolean("fs.hdfs.impl.disable.cache", true);
FileSystem fileSystem = FileSystem.get(conf);
Orlop answered 24/6, 2014 at 12:49 Comment(1)
a bit brief and missing reasoning :)Curcio
S
5

I had encountered a similar issue that prompted java.io.IOException: Filesystem closed. Finally, I found I closed the filesystem somewhere else. The hadoop filesystem API returns the same object. So if I closed one filesystem, then all filesystems are closed. I get the solution from this answer

Septicemia answered 23/12, 2014 at 3:0 Comment(1)
that was a really easy, but worthy advice. I closed the connection in the finally statement which (I was not aware of) was executed always (even with the reached return statement https://mcmap.net/q/40471/-does-a-finally-block-always-get-executed-in-java).Guereza
C
0

I've stolen this from the thread linked in the answer above but I think it's worth posting as an answer here. If you use FileSystem.get you are getting a global FileSystem that other code can close. The answer from the other thread worked for me:

"You have to use FileSystem.newInstance to avoid using a shared connection. It will give you a unique, non-shared instance."

Comradery answered 19/12, 2022 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.