syft icon indicating copy to clipboard operation
syft copied to clipboard

fix: better clean up of file handles

Open willmurphyscode opened this issue 2 years ago • 0 comments

Previously, the ELF binary package cataloger would leak file handles, and the generic cataloger loop would leak file handles if parsing the file panicked. Instead, ensure both situations defer close new file readers as soon as they are made.

The incorrect behavior had been happening for some time, but was probably exposed by #2814 which caused the ELF binary package cataloger to rely more on file handles and less on in-memory buffers.

Fixes #2819 - in my testing, syft 1.3.0 needs about 1500 concurrent file handles to parse pytorch/pytorch:latest; after this change, the number is closer to 800.

willmurphyscode avatar Apr 29 '24 17:04 willmurphyscode