Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit cdcd605

Browse files
committed
Increase the number of available file descriptors
notify_test and query_test run out of descriptors on some platforms. % ./notify_test [==========] Running 1 test(s). [ RUN ] notify_start netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace 0 libisc-9.19.9-dev.dylib 0x00000001045c5080 default_callback + 72 1 libisc-9.19.9-dev.dylib 0x00000001045c4ffc isc_assertion_failed + 56 2 libisc-9.19.9-dev.dylib 0x00000001045b8bcc start_tcp_child + 304 3 libisc-9.19.9-dev.dylib 0x00000001045b8710 isc_nm_listentcp + 636 4 libisc-9.19.9-dev.dylib 0x00000001045b3e0c isc_nm_listenstreamdns + 344 5 libns-9.19.9-dev.dylib 0x0000000104b90630 ns_interface_listentcp + 152 6 libns-9.19.9-dev.dylib 0x0000000104b8f65c interface_setup + 488 7 libns-9.19.9-dev.dylib 0x0000000104b8de98 do_scan + 2028 8 libns-9.19.9-dev.dylib 0x0000000104b8d640 ns_interfacemgr_scan + 212 9 notify_test 0x000000010418ddd0 scan_interfaces + 44 10 libisc-9.19.9-dev.dylib 0x00000001045d5fd8 isc__job_cb + 116 11 libuv.1.dylib 0x000000010545afe4 uv__run_idle + 152 12 libuv.1.dylib 0x0000000105455cd0 uv_run + 204 13 libisc-9.19.9-dev.dylib 0x00000001045e1120 loop_run + 460 14 libisc-9.19.9-dev.dylib 0x00000001045df824 loop_thread + 44 15 libisc-9.19.9-dev.dylib 0x00000001045df6dc isc_loopmgr_run + 456 16 notify_test 0x000000010418b900 run_test_notify_start + 88 17 libcmocka.0.dylib 0x00000001054968c0 cmocka_run_one_test_or_fixture + 448 18 libcmocka.0.dylib 0x0000000105494ca4 _cmocka_run_group_tests + 848 19 notify_test 0x000000010418be60 main + 120 20 libdyld.dylib 0x0000000181509430 start + 4 Abort % ./query_test [==========] Running 4 test(s). [ RUN ] ns__query_sfcache netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace 0 libisc-9.19.9-dev.dylib 0x000000010294d080 default_callback + 72 1 libisc-9.19.9-dev.dylib 0x000000010294cffc isc_assertion_failed + 56 2 libisc-9.19.9-dev.dylib 0x0000000102940bcc start_tcp_child + 304 3 libisc-9.19.9-dev.dylib 0x0000000102940710 isc_nm_listentcp + 636 4 libisc-9.19.9-dev.dylib 0x000000010293be0c isc_nm_listenstreamdns + 344 5 libns-9.19.9-dev.dylib 0x00000001026cc630 ns_interface_listentcp + 152 6 libns-9.19.9-dev.dylib 0x00000001026cb65c interface_setup + 488 7 libns-9.19.9-dev.dylib 0x00000001026c9e98 do_scan + 2028 8 libns-9.19.9-dev.dylib 0x00000001026c9640 ns_interfacemgr_scan + 212 9 query_test 0x00000001026a1018 scan_interfaces + 44 10 libisc-9.19.9-dev.dylib 0x000000010295dfd8 isc__job_cb + 116 11 libuv.1.dylib 0x0000000103996fe4 uv__run_idle + 152 12 libuv.1.dylib 0x0000000103991cd0 uv_run + 204 13 libisc-9.19.9-dev.dylib 0x0000000102969120 loop_run + 460 14 libisc-9.19.9-dev.dylib 0x0000000102967824 loop_thread + 44 15 libisc-9.19.9-dev.dylib 0x00000001029676dc isc_loopmgr_run + 456 16 query_test 0x000000010269cf34 run_test_ns__query_sfcache + 88 17 libcmocka.0.dylib 0x00000001028068c0 cmocka_run_one_test_or_fixture + 448 18 libcmocka.0.dylib 0x0000000102804ca4 _cmocka_run_group_tests + 848 19 query_test 0x000000010269eab8 main + 116 20 libdyld.dylib 0x0000000181509430 start + 4 Abort % expected_creads can exceed the number of file descriptors on some platforms. % ./udp_test [==========] Running 18 test(s). [ RUN ] mock_listenudp_uv_udp_open [ OK ] mock_listenudp_uv_udp_open [ RUN ] mock_listenudp_uv_udp_bind [ OK ] mock_listenudp_uv_udp_bind [ RUN ] mock_listenudp_uv_udp_recv_start [ OK ] mock_listenudp_uv_udp_recv_start [ RUN ] mock_udpconnect_uv_udp_open [ OK ] mock_udpconnect_uv_udp_open [ RUN ] mock_udpconnect_uv_udp_bind [ OK ] mock_udpconnect_uv_udp_bind [ RUN ] mock_udpconnect_uv_udp_connect [ OK ] mock_udpconnect_uv_udp_connect [ RUN ] mock_udpconnect_uv_recv_buffer_size [ OK ] mock_udpconnect_uv_recv_buffer_size [ RUN ] mock_udpconnect_uv_send_buffer_size [ OK ] mock_udpconnect_uv_send_buffer_size [ RUN ] udp_noop [ OK ] udp_noop [ RUN ] udp_noresponse [ OK ] udp_noresponse [ RUN ] udp_shutdown_connect [ OK ] udp_shutdown_connect [ RUN ] udp_shutdown_read [ OK ] udp_shutdown_read [ RUN ] udp_cancel_read [ OK ] udp_cancel_read [ RUN ] udp_timeout_recovery [ OK ] udp_timeout_recovery [ RUN ] udp_double_read [ OK ] udp_double_read [ RUN ] udp_recv_one [ OK ] udp_recv_one [ RUN ] udp_recv_two [ OK ] udp_recv_two [ RUN ] udp_recv_send udp__connect_cb(0x0, too many open files, 0x0) udp__connect_cb(0x0, too many open files, 0x0) udp__connect_cb(0x0, too many open files, 0x0) udp__connect_cb(0x0, too many open files, 0x0) udp__connect_cb(0x0, too many open files, 0x0) udp__connect_cb(0x0, too many open files, 0x0) %
1 parent 5bcfd46 commit cdcd605

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/libtest/isc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <signal.h>
1818
#include <stdbool.h>
1919
#include <stdlib.h>
20+
#include <sys/resource.h>
2021
#include <time.h>
2122

2223
#include <isc/buffer.h>
@@ -40,6 +41,18 @@ isc_taskmgr_t *taskmgr = NULL;
4041
isc_nm_t *netmgr = NULL;
4142
unsigned int workers = -1;
4243

44+
static void
45+
adjustnofile(void) {
46+
struct rlimit rl;
47+
48+
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
49+
if (rl.rlim_cur != rl.rlim_max) {
50+
rl.rlim_cur = rl.rlim_max;
51+
setrlimit(RLIMIT_NOFILE, &rl);
52+
}
53+
}
54+
}
55+
4356
int
4457
setup_mctx(void **state __attribute__((__unused__))) {
4558
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
@@ -107,6 +120,8 @@ int
107120
setup_netmgr(void **state __attribute__((__unused__))) {
108121
REQUIRE(loopmgr != NULL);
109122

123+
adjustnofile();
124+
110125
isc_netmgr_create(mctx, loopmgr, &netmgr);
111126

112127
return (0);

0 commit comments

Comments
 (0)