From: Michael Orlitzky Date: Thu, 15 Sep 2022 14:01:07 +0000 (-0400) Subject: bin/djbdns-logparse.py: add comment about open file descriptors. X-Git-Tag: 0.0.1~47 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=djbdns-logparse.git;a=commitdiff_plain;h=2b9cc3504eabf66e04b6d0eace01427ae72bcefe bin/djbdns-logparse.py: add comment about open file descriptors. --- 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)