Skip to content

Can you confirm Windows shutdown hang risk in ovpncli? #416

@pravorskyi

Description

@pravorskyi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions