Skip to content

Commit f2bddbd

Browse files
authored
Merge pull request #614 from snehashisp/disable-auto-close
FIX: Set fs.automatic.close to false in Hadoop configuration
2 parents 10e8c6a + 22d3403 commit f2bddbd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/io/confluent/connect/hdfs/DataWriter.java

+11
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ public DataWriter(
132132
hadoopConfiguration.addResource(new Path(config.hadoopConfDir() + "/hdfs-site.xml"));
133133
}
134134

135+
// By default all FileSystem clients created through the java Hadoop clients are auto
136+
// closed at JVM shutdown. This can interfere with the normal shutdown logic of the connector
137+
// where the created clients are used to clean up temporary files (if the client was closed
138+
// prior, then this operation throws a Filesystem Closed error). To prevent this behavior we
139+
// set the Hadoop configuration fs.automatic.close to false. All created clients are closed as
140+
// part of the connector lifecycle. This is anyways necessary as during connector deletion the
141+
// connector lifecycle needs to close the clients, as the JVM shutdown hooks don't come into the
142+
// picture. Hence we should always operate with fs.automatic.close as false. If in future we
143+
// find that we are leaking client connections, we need to fix the lifecycle to close those.
144+
hadoopConfiguration.setBoolean("fs.automatic.close", false);
145+
135146
if (config.kerberosAuthentication()) {
136147
configureKerberosAuthentication(hadoopConfiguration);
137148
}

0 commit comments

Comments
 (0)