Evan Hunt and Witold Kręcicki
31fe4bbe7c
lock manager when stopping workers, to prevent a possible shutdown deadlock
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
a0410678de
Don't assert if there's left-over data after reading a DNS TCP message.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
6900793dba
set the base pointer correctly when gluing TCP reads into a single message
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
638a289ca9
Implement "maxudp" for netmgr so that the legacy test will pass.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
1102ec73a7
remove obsolete references to '-T clienttest'
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
67211aa288
acquire manager lock before sending 'stoplisten' events to workers
...
this prevents a potential race between isc_nm_udp_stoplistening()
and isc_nm_pause() which could cause a server to deadlock.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
7bc1004f00
always reference the client->handle before ns_query_recurse()
...
this supercedes the experiment in commit eab6c2bff
("attach to nmhandle during zerottl refetch"), and ensures that
the client can't be reset before fetch_callback() is reached.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
44e7fec8a7
make "stoplisten" events asynchronous so we can issue them while paused
...
when reconfiguring a server we're in task exclusive mode, which
means the netmgr is paused. previously, when we issued "stoplistening"
events, we would wait for the worker thread to process the event
before proceeding. since that can't happen while paused, we could
hit a deadlock during reconfig if the listen-on addresses changed.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
a5ca545f39
more fixes for handle reference counting
...
- ref handle in tcp_send_direct and tcp_send_cb
- unref handle when xfrout fails
- remove some unneeded unrefs in ns__client_request
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
0e2154f980
style nits
2019-11-05 12:54:45 +01:00
Witold Kręcicki
7a677338ec
Fix compilation issues in mutexatomics mode
2019-11-05 12:54:45 +01:00
Witold Kręcicki
334d9aa90b
Use pkg-config to detect libuv
2019-11-05 12:54:45 +01:00
Witold Kręcicki
3584565c4b
netmgr: fixes for Windows:
...
- MSVC doesn't like empty {} initializers
- Emulate stdalign.h on Windows with __declspec(align())
- There's no usleep on Windows
- Add missing symbols to libns.def and libisc.def
- Proper use of SO_REUSE****
- libuv detection in Configure
- Minor fixes to the atomics code
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
1b4bbebd11
eliminate isc_nm_shutdown in favor of isc_nm_detach
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
e457feb1e3
continue client/handle reference counting changes
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
021848bca9
experiment: eliminate client reference counting; use nmhandler only
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
669f659fe3
partial fix: improve socket and metmgr cleanup for orderly shudown
...
- when we attempt to shut down a parent socket, but its children
still have active handles, the destruction is delayed, and previously
it was never resumed. now, when the last handle for a child socket is
detached, we check again whether the parent can be destroyed.
- the netmgr is not shut down until all references to it are detached.
2019-11-05 12:54:45 +01:00
Witold Kręcicki
e3b597ffa7
Add atomic_exchange operations to stdatomics.h
2019-11-05 12:54:45 +01:00
Witold Kręcicki
7c35e1894f
netmgr: translate libuv error codes to isc_result_t's
2019-11-05 12:54:45 +01:00
Witold Kręcicki
e0fd7d883c
netmgr: isc__nm_uverr2result function converting libuv errors to libisc errors
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
b25d42c3e5
count active handles in child sockets before destroying a parent socket
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
b0928cf610
finish some TODO's
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
e8203e3cee
documentation and namespace cleanup
...
- document functions in netmgr.h and netmgr-int.h
- combine identical callback typedefs into one
- remove functions that were never called
- make functions called in only one file static
- rename isc__nm_handle_*() functions to isc__nm_async_*() to avoid
confusion with the isc__nmhandle type.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
e75d5cb681
attach the interface when creating clientmgr, rather than assigning
...
this prevents a potential crash during shutdown when an interface
is destroyed while a client object is still in flight.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
8fde91ce99
statistics test: fix the expected "active sockets" values
...
since the listening socket is now handled by the netmgr, it isn't
counted in the "active sockets" stat anymore, so the expected values
have changed.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
99689ba839
further ns_client cleanup
...
- remove unnecessary client->newstate
- clarify purpose of client->next by renaming to client->cleanup
2019-11-05 12:54:45 +01:00
Witold Kręcicki
09a3650ef2
netmgr: don't try to send to a closed tcpdns socket
2019-11-05 12:54:45 +01:00
Witold Kręcicki
6c239005ad
netmgr: rename all 'socket' to 'sock', to avoid conflict with socket()
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
b8747be85c
fix incorrect initialization of the ns_interface object
...
this had caused a crash on shutdown in some cases.
2019-11-05 12:54:45 +01:00
Witold Kręcicki
6938bca291
Address compilation errors - gcc overzealousness with empty initializers (C99 declares that those should be filled as static initializers), one uninitialized value
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
e940ff0cc1
don't use the same query source port and listening port
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
f5462083e7
experiment: attach to nmhandle during zerottl refetch
2019-11-05 12:54:45 +01:00
Witold Kręcicki
0246b46f06
netmgr test: mutex (and not atomics) based astack
2019-11-05 12:54:45 +01:00
Witold Kręcicki
54d420f391
netmgr:
...
- clean up isc_nmevent structures - make generic types and just typedef to them
- fix atomic clang warnings in astack
- add pause/resume read for TCP
- add sequential (not-pipelining) support for TCPDNS
- keep peer address in the socket for TCP connections, it's constant for a socket
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
7a9fc7cf13
remove unused members of ns_client
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
d8a7295bc0
correct accounting of xfrout message length
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
22795df7e5
reattach the nmhandle to the client when running a prefetch
...
this delays the destruction of the client object until after the
prefetch is finished.
also added some missing CTRACE logging in query.c, in the process of
diagnosing this error.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
9941edd286
add missing calls to isc_task_unpause()
...
also more style fixes
2019-11-05 12:54:45 +01:00
Witold Kręcicki
ff2c657f6e
netmgr:
...
- choose udp thread properly
- socket shutdown fixes
2019-11-05 12:54:45 +01:00
Witold Kręcicki
c52e0113f6
netmgr: process incomplete TCP packets correctly
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
5158ba5b9b
Style nits
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
6d7934d6f5
use isc_mem_get() instead of malloc()
...
the advantage of this is it allows the use of memory context
accounting, but it will likely have performance consequences.
XXX: we need to find a way to do a TCPDNS send without having to allocate
and copy the region that's to be sent.
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
780de22d9f
rename isc_faaa_queue to isc_queue
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
f6e42f7e81
Style fixes
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
48b4576318
remove the clienmgr->inactive queue, and the ISC_QUEUE data structure
2019-11-05 12:54:45 +01:00
Witold Kręcicki
f393756c70
netmgr experiment: constant-sized stack for handle/uvreq reuse
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
5eb96c2f90
remove an extra call to isc_nmhandle_detach()
2019-11-05 12:54:45 +01:00
Evan Hunt and Witold Kręcicki
e91e8f0e2a
Style fixes
2019-11-05 12:54:45 +01:00
Witold Kręcicki
2ab3e753a2
netmgr: Verify that we're not going below 0 with reference counter
2019-11-05 12:54:44 +01:00
Witold Kręcicki
356c73d2da
Free all extra data in ns_client_t in client_put_cb
2019-11-05 12:54:44 +01:00