Commit f521c2c
committed
MINOR: server: take proxy refcount when deleting a server
When a server is deleted via "del server", increment refcount of its
parent backend. This is necessary as the server is not referenced
anymore in the backend, but can still access it via its own <proxy>
member. Thus, backend removal must not happen until the complete purge
of the server.
The proxy refcount is released in srv_drop() if the flag SRV_F_DELETED
is set, which indicates that "del server" was used. This operation is
performed after the complete release of the server instance to ensure no
access will be performed on the proxy via itself. The refcount must not
be decremented if a server is freed without "del server" invokation.
Another solution could be for servers to always increment the refcount.
However, for now in haproxy refcount usage is limited, so the current
approach is preferred. It should also ensure that if the refcount is
still incremented, it may indicate that some servers are not completely
purged themselves.
Note that this patch may cause issues if "del backend" are used in
parallel with LUA scripts referencing servers. Currently, any servers
referenced by LUA must be released by its garbage collector to ensure it
can be finally freed. However, it appeas that in some case the gc does
not run for several minutes. At least this has been observed with Lua
version 5.4.8. In the end, this will result in indefinitely blocking of
"del backend" commands.1 parent ee1f052 commit f521c2c
1 file changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3218 | 3218 | | |
3219 | 3219 | | |
3220 | 3220 | | |
| 3221 | + | |
3221 | 3222 | | |
3222 | 3223 | | |
3223 | 3224 | | |
3224 | 3225 | | |
3225 | 3226 | | |
3226 | 3227 | | |
3227 | 3228 | | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
3228 | 3233 | | |
3229 | 3234 | | |
3230 | 3235 | | |
| |||
3264 | 3269 | | |
3265 | 3270 | | |
3266 | 3271 | | |
| 3272 | + | |
| 3273 | + | |
3267 | 3274 | | |
3268 | 3275 | | |
3269 | 3276 | | |
| |||
6527 | 6534 | | |
6528 | 6535 | | |
6529 | 6536 | | |
| 6537 | + | |
| 6538 | + | |
| 6539 | + | |
| 6540 | + | |
| 6541 | + | |
| 6542 | + | |
| 6543 | + | |
| 6544 | + | |
| 6545 | + | |
| 6546 | + | |
6530 | 6547 | | |
6531 | 6548 | | |
6532 | 6549 | | |
| |||
6535 | 6552 | | |
6536 | 6553 | | |
6537 | 6554 | | |
6538 | | - | |
6539 | | - | |
6540 | | - | |
6541 | | - | |
6542 | | - | |
6543 | | - | |
6544 | | - | |
6545 | | - | |
6546 | | - | |
6547 | 6555 | | |
6548 | 6556 | | |
6549 | 6557 | | |
| |||
0 commit comments