Files
opendht/src
CyrilleandCopilot App 603a11494e http: run resolver callbacks and connect on the io executor
Resolver::add_callback invoked the callback synchronously on the
calling thread when resolution was already completed. Since Request
objects are commonly created and sent from application threads while
the io_context runs on a dedicated io thread, the whole continuation
(Request::send -> Request::connect -> Connection::async_connect ->
asio::async_connect start_connect_op) then executed on the caller's
thread, mutating asio reactor state (kqueue/epoll per-descriptor op
queues) concurrently with the io thread. This data race corrupts the
heap and was observed crashing with SIGSEGV/EXC_BAD_ACCESS inside
asio start_connect_op, both from the io thread and from the
application main thread (e.g. a name lookup reusing a shared,
already-completed Resolver), on macOS.

Fix by always posting completed-resolution callbacks to the
resolver's executor, so the connect chain consistently runs on the
io_context thread regardless of the caller.

Also make the Connection::async_connect completion handler hold a
weak_ptr to the Connection instead of capturing raw `this` and a
reference to the underlying socket, matching the existing
async_handshake pattern, so a Connection destroyed while a connect
operation is in flight (e.g. after a request timeout) can no longer
be written to after free.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-14 21:13:51 -04:00
..
2026-01-29 22:38:57 -05:00
2026-03-15 10:43:46 -04:00
2026-01-26 17:31:37 -05:00
2026-07-13 14:38:27 -04:00
2026-05-11 09:27:56 -04:00
2026-03-13 00:28:38 -04:00
2026-03-13 00:04:49 -04:00
2026-07-04 11:57:49 -04:00