mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-26 03:11:56 -05:00
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)
%
155 lines
2.9 KiB
C
155 lines
2.9 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
/*! \file */
|
|
|
|
#include <inttypes.h>
|
|
#include <signal.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <sys/resource.h>
|
|
#include <time.h>
|
|
|
|
#include <isc/buffer.h>
|
|
#include <isc/hash.h>
|
|
#include <isc/loop.h>
|
|
#include <isc/managers.h>
|
|
#include <isc/mem.h>
|
|
#include <isc/os.h>
|
|
#include <isc/string.h>
|
|
#include <isc/task.h>
|
|
#include <isc/timer.h>
|
|
#include <isc/util.h>
|
|
|
|
#include <tests/isc.h>
|
|
|
|
isc_mem_t *mctx = NULL;
|
|
isc_log_t *lctx = NULL;
|
|
isc_loop_t *mainloop = NULL;
|
|
isc_loopmgr_t *loopmgr = NULL;
|
|
isc_taskmgr_t *taskmgr = NULL;
|
|
isc_nm_t *netmgr = NULL;
|
|
unsigned int workers = -1;
|
|
|
|
static void
|
|
adjustnofile(void) {
|
|
struct rlimit rl;
|
|
|
|
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
|
|
if (rl.rlim_cur != rl.rlim_max) {
|
|
rl.rlim_cur = rl.rlim_max;
|
|
setrlimit(RLIMIT_NOFILE, &rl);
|
|
}
|
|
}
|
|
}
|
|
|
|
int
|
|
setup_mctx(void **state __attribute__((__unused__))) {
|
|
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
|
isc_mem_create(&mctx);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
teardown_mctx(void **state __attribute__((__unused__))) {
|
|
isc_mem_destroy(&mctx);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
setup_loopmgr(void **state __attribute__((__unused__))) {
|
|
char *env_workers = NULL;
|
|
|
|
REQUIRE(mctx != NULL);
|
|
|
|
env_workers = getenv("ISC_TASK_WORKERS");
|
|
if (env_workers != NULL) {
|
|
workers = atoi(env_workers);
|
|
} else {
|
|
/* We always need at least two loops for some of the tests */
|
|
workers = isc_os_ncpus() + 1;
|
|
}
|
|
INSIST(workers != 0);
|
|
|
|
isc_loopmgr_create(mctx, workers, &loopmgr);
|
|
mainloop = isc_loop_main(loopmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
teardown_loopmgr(void **state __attribute__((__unused__))) {
|
|
REQUIRE(taskmgr == NULL);
|
|
REQUIRE(netmgr == NULL);
|
|
|
|
mainloop = NULL;
|
|
isc_loopmgr_destroy(&loopmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
setup_taskmgr(void **state __attribute__((__unused__))) {
|
|
REQUIRE(loopmgr != NULL);
|
|
|
|
isc_taskmgr_create(mctx, loopmgr, &taskmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
teardown_taskmgr(void **state __attribute__((__unused__))) {
|
|
isc_taskmgr_destroy(&taskmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
setup_netmgr(void **state __attribute__((__unused__))) {
|
|
REQUIRE(loopmgr != NULL);
|
|
|
|
adjustnofile();
|
|
|
|
isc_netmgr_create(mctx, loopmgr, &netmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
teardown_netmgr(void **state __attribute__((__unused__))) {
|
|
REQUIRE(loopmgr != NULL);
|
|
|
|
isc_netmgr_destroy(&netmgr);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
setup_managers(void **state) {
|
|
setup_loopmgr(state);
|
|
setup_taskmgr(state);
|
|
setup_netmgr(state);
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
teardown_managers(void **state) {
|
|
teardown_netmgr(state);
|
|
teardown_taskmgr(state);
|
|
teardown_loopmgr(state);
|
|
|
|
return (0);
|
|
}
|