Commit 494d014
committed
BUG/MEDIUM: configuration: stats refresh delay defaults to seconds
The 'stats refresh' keyword takes a delay that HAProxy reads as seconds
when no suffix is given, but it was parsed with ParseTimeout, which
assumes milliseconds. The model therefore held a value a thousand times
smaller than the one in the configuration file, and serializing wrote
that millisecond count back as a bare number, which HAProxy then read as
seconds again.
The raw text happened to survive a parse and serialize cycle, so this
stayed invisible when only rewriting a file, but the value exposed
through the model was wrong in both directions. Reading 'stats refresh
30' reported 30 ms for what HAProxy applies as 30 s, and asking for
30000 ms through the model produced 'stats refresh 30000', which HAProxy
applies as 30000 s.
Parse the delay with ParseTimeoutDefaultSeconds and serialize it with an
explicit 'ms' suffix, matching what is already done for the other
keywords using that parser, namely clitcpka-idle, clitcpka-intvl,
srvtcpka-idle and srvtcpka-intvl. The two changes belong together: fixing
the parser alone would leave the serializer scaling the delay by a
thousand on every reload, and would break callers that verify a submitted
configuration against its regenerated form.
The same fix is already in v6, where the delay is described as a duration
defaulting to seconds and serialized through misc.SerializeTime.1 parent 3aa197d commit 494d014
2 files changed
Lines changed: 79 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1076 | 1076 | | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | | - | |
| 1079 | + | |
| 1080 | + | |
1080 | 1081 | | |
1081 | 1082 | | |
1082 | 1083 | | |
| |||
2605 | 2606 | | |
2606 | 2607 | | |
2607 | 2608 | | |
2608 | | - | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
2609 | 2612 | | |
2610 | 2613 | | |
2611 | 2614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments