]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Increase the number of file descriptors available
authorMark Andrews <marka@isc.org>
Tue, 5 Oct 2021 05:01:56 +0000 (16:01 +1100)
committerMark Andrews <marka@isc.org>
Tue, 5 Oct 2021 06:46:56 +0000 (17:46 +1100)
The 'listenlist_test', 'notify_test', and 'query_test' tests failed
when the descriptor limit was 256 on MacOS 11.6 with 8 cpus. On the
test platform the limit needed to be increased to ~400.  Increase
the limit to at least 1024 to give some head room.

(cherry picked from commit 877f52b7724d3f177486f6556493a07b6ce54661)

lib/ns/tests/nstest.c

index 4136d5397c6f9cf54d78bc3d1c6a5a2a0c067a66..238450d478946a52d73a81dacfcdde5c83c87f69 100644 (file)
@@ -28,6 +28,7 @@
 #include <isc/os.h>
 #include <isc/print.h>
 #include <isc/random.h>
+#include <isc/resource.h>
 #include <isc/socket.h>
 #include <isc/stdio.h>
 #include <isc/string.h>
@@ -295,6 +296,22 @@ ns_test_begin(FILE *logfile, bool start_managers) {
        test_running = true;
 
        if (start_managers) {
+               isc_resourcevalue_t files;
+
+               /*
+                * The 'listenlist_test', 'notify_test', and 'query_test'
+                * tests need more than 256 descriptors with 8 cpus.
+                * Bump up to at least 1024.
+                */
+               result = isc_resource_getcurlimit(isc_resource_openfiles,
+                                                 &files);
+               if (result == ISC_R_SUCCESS) {
+                       if (files < 1024) {
+                               files = 1024;
+                               (void)isc_resource_setlimit(
+                                       isc_resource_openfiles, files);
+                       }
+               }
                CHECK(isc_app_start());
        }
        if (debug_mem_record) {