mongodb/mongo-hadoop — pull request #115 by inq (2014-10-01 06:03:33+00:00)
Title: [Bugfix] Connection Leaks

I am using BSON as the input format of our s3 input storage. In contrast of the HDFS, Amazon s3 seems to be sensitive to leaks. As reading massive files, I met tons of "org.apache.http.conn.ConnectionPoolTimeoutException." After some inspection, I found some leaks and patched it.

The first bug was in the BSONFileInputFormat. please see this code: [TextInputFormat](https://github.com/apache/hadoop-common/blob/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/TextInputFormat.java) We must not initialize the BSONFileRecordReader. It seems to causes "double initialization." After removing this initializing routine, I eliminated the ConnectionPoolTimeoutException.

The second bug was in the BSONSplitter. Since the original routine did not close the fsDataStream and fs, It causes error for massive files, too.