Can you confirm Windows shutdown hang risk in ovpncli?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 467
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in client/ovpncli.cpp at trigger_async_stop_local() and trace the Windows worker thread running io_context::run(), including teardown and io_context ownership. Confirm whether an owned context can leave shutdown or disconnect blocked by outstanding work or overlapped operations, and whether the proposed guarded stop addresses the hang without affecting shared contexts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100