-
Notifications
You must be signed in to change notification settings - Fork 451
Description
Hi OpenVPN team,
We’re seeing a potential Windows shutdown/disconnect hang scenario in client/ovpncli.cpp and want to confirm our understanding is correct.
In trigger_async_stop_local() the code stops async_stop_local_, but on Windows it looks possible for the worker thread running io_context::run() to remain blocked/alive due to outstanding work or pending overlapped/IOCP operations. In that case, stop/disconnect (or process exit) can hang because the run() loop never returns and the thread can’t be joined cleanly.
Our proposed fix is Windows-only and only when the library owns the context:
#ifdef _WIN32
if (io_context_owned) {
io_context_->stop();
}
#endif
The reasoning is that if openvpn3 created/owns the io_context, it should also stop it during teardown; and the io_context_owned guard avoids affecting embedding apps that provide a shared io_context.
Could you please confirm is this hang scenario plausible/known in your Windows code path?
Thanks in advance.