mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: pools: preset the allocation failure rate to 1% with -dMfail
Using -dMfail alone does nothing unless tune.fail-alloc is set, which renders it pretty useless as-is, and is not intuitive. Let's change this so that the filure rate is preset to 1% when the option is set on the command line. This allows to inject failures without having to edit the configuration.
This commit is contained in:
parent
69869e6354
commit
0c4348c982
@ -2865,7 +2865,9 @@ tune.fail-alloc
|
||||
If compiled with DEBUG_FAIL_ALLOC or started with "-dMfail", gives the
|
||||
percentage of chances an allocation attempt fails. Must be between 0 (no
|
||||
failure) and 100 (no success). This is useful to debug and make sure memory
|
||||
failures are handled gracefully.
|
||||
failures are handled gracefully. When not set, the ratio is 0. However the
|
||||
command-line "-dMfail" option automatically sets it to 1% failure rate so that
|
||||
it is not necessary to change the configuration for testing.
|
||||
|
||||
tune.fd.edge-triggered { on | off } [ EXPERIMENTAL ]
|
||||
Enables ('on') or disables ('off') the edge-triggered polling mode for FDs
|
||||
|
@ -290,7 +290,8 @@ list of options is :
|
||||
- fail / no-fail:
|
||||
This enables randomly failing memory allocations, in conjunction with
|
||||
the global "tune.fail-alloc" setting. This is used to detect missing
|
||||
error checks in the code.
|
||||
error checks in the code. Setting the option presets the ratio to 1%
|
||||
failure rate.
|
||||
|
||||
- no-merge / merge:
|
||||
By default, pools of very similar sizes are merged, resulting in more
|
||||
|
@ -1080,10 +1080,16 @@ int pool_parse_debugging(const char *str, char **err)
|
||||
*/
|
||||
if (dbg_options[v].flg == POOL_DBG_UAF)
|
||||
new_dbg |= POOL_DBG_NO_CACHE;
|
||||
/* fail should preset the tune.fail-alloc ratio to 1% */
|
||||
if (dbg_options[v].flg == POOL_DBG_FAIL_ALLOC)
|
||||
mem_fail_rate = 1;
|
||||
break;
|
||||
}
|
||||
else if (isteq(feat, ist(dbg_options[v].clr))) {
|
||||
new_dbg &= ~dbg_options[v].flg;
|
||||
/* no-fail should reset the tune.fail-alloc ratio */
|
||||
if (dbg_options[v].flg == POOL_DBG_FAIL_ALLOC)
|
||||
mem_fail_rate = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user