You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing a conditional restart (SIGUSR1) of an OpenVPN server with a plugin, openvpn_plugin_client_constructor_v1 is called to create a new generic/top-level client instance without deconstructing the previous one with openvpn_plugin_client_destructor_v1. When the server is stopped after one or more conditional restarts, only the last instance is destructed.
This not only causes a memory leak, it also creates a logical issue when trying to distinguish the allocation of a generic/top-level client and a real client early on by counting allocations/deallocations.
To reproduce
Write a simple OpenVPN plugin (see below for a minimal example).
Make an allocation in openvpn_plugin_client_constructor_v1 and return a pointer to it.
Free the allocation in openvpn_plugin_client_destructor_v1.
Start an OpenVPN server with the plugin loaded.
Trigger a conditional restart of the OpenVPN server via SIGUSR1 to observe the issue.
Expected behavior
On a conditional restart, either openvpn_plugin_client_constructor_v1 should not be called, or openvpn_plugin_client_destructor_v1 should be called beforehand, so that there is no memory leak.
I have never used these constructor/destructor functions myself, but from your description this definitely sounds like something we need to look into. Pinging @dsommers as well.
Describe the bug
When performing a conditional restart (
SIGUSR1
) of an OpenVPN server with a plugin,openvpn_plugin_client_constructor_v1
is called to create a new generic/top-level client instance without deconstructing the previous one withopenvpn_plugin_client_destructor_v1
. When the server is stopped after one or more conditional restarts, only the last instance is destructed.This not only causes a memory leak, it also creates a logical issue when trying to distinguish the allocation of a generic/top-level client and a real client early on by counting allocations/deallocations.
To reproduce
openvpn_plugin_client_constructor_v1
and return a pointer to it.openvpn_plugin_client_destructor_v1
.SIGUSR1
to observe the issue.Expected behavior
On a conditional restart, either
openvpn_plugin_client_constructor_v1
should not be called, oropenvpn_plugin_client_destructor_v1
should be called beforehand, so that there is no memory leak.Version information
Additional context
Minimal example:
Log:
The text was updated successfully, but these errors were encountered: