jordanlytle / SmbAbstraction

Implements the System.IO.Abstractions interfaces for interacting with the filesystem, and adds support for interacting with UNC or SMB paths
MIT License
6 stars 8 forks source link

Ensure File Closure in Error Scenarios #30

Closed ghost closed 4 years ago

ghost commented 4 years ago

Briefed Vinh about this one a little earlier today. Error scenarios can cause us to skip closing open files entirely. There were some places in the code that were trying to handle as part of the catch, but most places had no safeguard to ensure closure.

Over time, failure conditions will cause open files to build up to the point that requests are no longer processed. This same behavior will cause file access to become spotty as locks build up on files preventing subsequent access/modification.

I've added some redundancy around closures by closing open files as part of each finally block.

Vinh, no rush to get this in right away. I'm going to take these changes and do some more local testing to verify these are all the changes needed to eliminate the open file problems.

Jo0 commented 4 years ago

Thanks for adding this Colby!