In the ExportSnapshot tool the input and output FileSystem objects are being obtained using the method FileSystem.get which will either create a new FileSystem object or simply take an existing object out of the cache if a suitable one exists.
After it is done with the these FileSystem objects it will close them.
The issue here is that the ExportSnapshot tool will potentially remove preexisting FileSystem objects from the cache by closing said objects. This will break any apis running in the same process that are relying on these cached FileSystem objects.
A simple solution could, I believe, fix this problem without affecting the functionality of the ExportSnapshot tool:
Change ExportSnapshot.java lines 943:
FileSystem inputFs = FileSystem.get(inputRoot.toUri(), srcConf);
FileSystem outputFs = FileSystem.get(outputRoot.toUri(), destConf);
to use FileSystem.newInstance instead of FileSystem.get:
FileSystem inputFs = FileSystem.newInstance(inputRoot.toUri(), srcConf);
FileSystem outputFs = FileSystem.newInstance(outputRoot.toUri(), destConf);
This will create a unique entry in the cache and in this way prevent the closure of these FileSystem objects from wiping out any preexisting FileSystem objects. It will also ensure that no unused FileSystem objects created by the ExportSnapshot tool will be left taking up heap space and potentially causing memory issues.
I am happy to submit a fix for this, but figured I would open an issue first so the issue can be properly discussed and tracked.
Also note this is the first issue I have opened so I apologize in advance for any standard procedures and/or best practices I haven't followed.