From 2b9cc3504eabf66e04b6d0eace01427ae72bcefe Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 15 Sep 2022 10:01:07 -0400 Subject: [PATCH] bin/djbdns-logparse.py: add comment about open file descriptors. --- bin/djbdns-logparse.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/djbdns-logparse.py b/bin/djbdns-logparse.py index 95bc4e0..9af8362 100755 --- a/bin/djbdns-logparse.py +++ b/bin/djbdns-logparse.py @@ -295,6 +295,15 @@ def main(): default=[stdin], help="djbdns logfile to process (default: stdin)") + # Warning: argparse automatically opens its file arguments here, + # and they only get closed when the program terminates. There's no + # real benefit to closing them one-at-a-time after calling + # parse_logfile(), because the "scarce" resource of open file + # descriptors gets consumed immediately, before any processing has + # happened. In other words, if you're going to run out of file + # descriptors, it's going to happen right now. + # + # So anyway, don't run this on several million logfiles. args = parser.parse_args() for f in args.logfiles: parse_logfile(f) -- 2.43.2