mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-14 14:11:00 +01:00
MEDIUM: stick-tables: Stop if stktable_trash_oldest() fails.
In stksess_new(), if the table is full, we call stktable_trash_oldest() to remove a few entries so that we have some room for a new one. It is unlikely, but possible, that stktable_trash_oldest() will fail. If so, just give up and do not add the new entry, instead of adding it anyway. Give up if stktable_trash_oldest() fails to free any entry
This commit is contained in:
parent
d5562e31bd
commit
7854331c71
@ -443,11 +443,13 @@ struct stksess *stksess_new(struct stktable *t, struct stktable_key *key)
|
|||||||
HA_ATOMIC_DEC(&t->current);
|
HA_ATOMIC_DEC(&t->current);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* note that it may fail to find any releasable slot due to
|
if (stktable_trash_oldest(t) < 1) {
|
||||||
* locking contention but it's not a problem in practice,
|
/*
|
||||||
* these will be recovered later.
|
* If we did not manage to purge any entry, give up.
|
||||||
*/
|
*/
|
||||||
stktable_trash_oldest(t);
|
HA_ATOMIC_DEC(&t->current);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ts = pool_alloc(t->pool);
|
ts = pool_alloc(t->pool);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user