Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to reexamine a change. Please visit
https://gerrit.openvpn.net/c/openvpn/+/2399?usp=email
to look at the new patch set (#2).
Change subject: manage: stop polling the listen socket while a client is
connected
......................................................................
manage: stop polling the listen socket while a client is connected
In server mode the management listen socket stays in the persistent
event set after a client is accepted. A second connection queued on it
keeps it readable, so every event wait returns immediately for the
management, management_io() finds nothing to do on the client socket,
and the server spins at 100% CPU while timers starve.
Remove sd_top from the event set on accept; it is re-added when the
state goes back to MS_LISTEN. Reset the cached state on removal, so the
next update registers the right socket even after an accept or close in
a standalone management loop, and skip the removal when nothing is
registered.
Trac: #681
GitHub: closes OpenVPN/openvpn#1167
Change-Id: I06302e82cdc7c98503430500daa4ec95f5ce961f
Signed-off-by: Gianmarco De Gregori <[email protected]>
---
M src/openvpn/manage.c
M src/openvpn/multi.c
2 files changed, 16 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/2399/2
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 75431a0..b032963 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -343,6 +343,17 @@
#endif
}
+#ifndef _WIN32
+static void
+man_delete_event(struct management *man, const socket_descriptor_t sd)
+{
+ if (man->persist.callback.delete_event)
+ {
+ (*man->persist.callback.delete_event)(man->persist.callback.arg, sd);
+ }
+}
+#endif
+
static void
man_close_socket(struct management *man, const socket_descriptor_t sd)
{
@@ -351,10 +362,7 @@
* Windows doesn't need this because the ne32 event is permanently
* enabled at struct management scope.
*/
- if (man->persist.callback.delete_event)
- {
- (*man->persist.callback.delete_event)(man->persist.callback.arg, sd);
- }
+ man_delete_event(man, sd);
#endif
openvpn_close_socket(sd);
}
@@ -2075,6 +2083,8 @@
{
#ifdef _WIN32
man_stop_ne32(man);
+#else
+ man_delete_event(man, man->connection.sd_top);
#endif
}
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index c71bcc1..16cb438 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -4048,9 +4048,10 @@
management_delete_event(void *arg, event_t event)
{
struct multi_context *m = (struct multi_context *)arg;
- if (m->multi_io)
+ if (m->multi_io && m->multi_io->management_persist_flags)
{
multi_tcp_delete_event(m->multi_io, event);
+ m->multi_io->management_persist_flags = 0;
}
}
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2399?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: release/2.7
Gerrit-Change-Id: I06302e82cdc7c98503430500daa4ec95f5ce961f
Gerrit-Change-Number: 2399
Gerrit-PatchSet: 2
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel