As explained by Christopher on github issue #665:
In 2.2, srv->idle_conns and srv->safe_conns are thread-safe lists. But
not in 2.1. So the patch must be reverted or the lists must be changed
to use mt_list instead. The same must be done in 2.0, but the mt_list
does not exist on this version.
I choose to revert it as the original bug is truly revealed in v2.2
after commit 079cb9af22da6 ("MEDIUM: connections: Revamp the way idle
connections are killed")
this should resolve github issue #665
This reverts commit e18f603012fe3b698a30fcedfb0684f48fe403aa.
This reverts commit 3b614335cf25a7081c25e0a789c932c5960f221c.
---
src/server.c | 39 +--
1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/src/server.c b/src/server.c
index 851f32a9..9f2452e0 100644
--- a/src/server.c
+++ b/src/server.c
@@ -51,7 +51,6 @@ static void srv_update_status(struct server *s);
static void srv_update_state(struct server *srv, int version, char **params);
static int srv_apply_lastaddr(struct server *srv, int *err_code);
static int srv_set_fqdn(struct server *srv, const char *fqdn, int dns_locked);
-static void srv_cleanup_connections(struct server *srv);
/* List head of all known server keywords */
static struct srv_kw_list srv_keywords = {
@@ -3780,11 +3779,8 @@ const char *update_server_addr_port(struct server *s,
const char *addr, const ch
}
out:
- if (changed) {
- /* force connection cleanup on the given server */
- srv_cleanup_connections(s);
+ if (changed)
srv_set_dyncookie(s);
- }
if (updater)
chunk_appendf(msg, " by '%s'", updater);
chunk_appendf(msg, "\n");
@@ -5016,8 +5012,6 @@ static void srv_update_status(struct server *s)
if (s->onmarkeddown &
HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
srv_shutdown_streams(s, SF_ERR_DOWN);
- /* force connection cleanup on the given server */
- srv_cleanup_connections(s);
/* we might have streams queued on this server and
waiting for
* a connection. Those which are redispatchable will be
queued
* to another server or to the proxy itself.
@@ -5346,37 +5340,6 @@ struct task *srv_cleanup_toremove_connections(struct
task *task, void *context,
return task;
}
-/* cleanup connections for a given server
- * might be useful when going on forced maintenance or live changing ip/port
- */
-static void srv_cleanup_connections(struct server *srv)
-{
- struct connection *conn;
- int did_remove;
- int i;
- int j;
-
- HA_SPIN_LOCK(OTHER_LOCK, _conn_srv_lock);
- for (i = 0; i < global.nbthread; i++) {
- did_remove = 0;
- HA_SPIN_LOCK(OTHER_LOCK, _lock[i]);
- for (j = 0; j < srv->curr_idle_conns; j++) {
- conn = LIST_ELEM(srv->idle_conns[tid].n, struct
connection *, list);
- if (!conn)
- conn = LIST_ELEM(srv->safe_conns[tid].n,
-struct connection *, list);
- if (!conn)
- break;
- did_remove = 1;
- LIST_ADDQ_LOCKED(_connections[i], >list);
- }
- HA_SPIN_UNLOCK(OTHER_LOCK, _lock[i]);
- if (did_remove)
- task_wakeup(idle_conn_cleanup[i], TASK_WOKEN_OTHER);
- }
- HA_SPIN_UNLOCK(OTHER_LOCK, _conn_srv_lock);
-}
-
struct task *srv_cleanup_idle_connections(struct task *task, void *context,
unsigned short state)
{
struct server *srv;
--
2.26.2