]> gitweb.michael.orlitzky.com - djbdns-logparse.git/commitdiff
bin/djbdns-logparse.py: add comment about open file descriptors.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 15 Sep 2022 14:01:07 +0000 (10:01 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 15 Sep 2022 14:01:07 +0000 (10:01 -0400)
bin/djbdns-logparse.py

index 95bc4e07758763fdab7af3bb1e40a7633bcf42a4..9af836262e78f1e485188a65a6854072d0de084b 100755 (executable)
@@ -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)