patterns: "del map/acl" removes only one of duplicate keys, "clear map/acl @<ver>" may do nothing (3.4 regression)
还没有人认领这个 Issue。
评估
调研方向
Start by reading pat_ref_gen_delete() and pat_ref_purge_range() in the pattern-reference code, then inspect the http-rules, converter, cli and lua reg-tests. Reproduce the duplicate-key deletion and version-specific clear cases from the issue. Done means all matching entries are removed and those regression tests pass.
由索引模型根据 Issue 内容生成。
描述
Detailed Description of the Problem
del map <map> <key>(anddel acl) removes only one entry when the key is duplicated; the others stay and still match.clear map @<ver> <map>(andclear acl @<ver>) does nothing while a lower version still has entries, the normal case afterprepare map.
Both report success. Affected: master (bd884a2), 3.4.x (3.4.6 tested). Not affected: 3.3.16, 3.2.25.
Expected Behavior
All entries of the key (1) or of version <ver> (2) are deleted, as in 3.3 and 3.2.
Steps to Reproduce the Behavior
With the configuration below and dup.map holding k1 v1, k1 v2, k2 v3 (one per line), on master:
$ echo "del map dup.map k1; show map dup.map" | socat - /tmp/ha.sock
0x1f34350 k1 v2
0x1f343d0 k2 v3
$ echo "prepare map dup.map; add map @1 dup.map n1 w1" | socat - /tmp/ha.sock
New version created: 1
$ echo "clear map @1 dup.map; show map @1 dup.map" | socat - /tmp/ha.sock
0x7f1ef009d1c0 n1 w1
Same steps on 3.3.16 and 3.2.25: all k1 entries removed, @1 cleared.
Do you have any idea what may have caused this?
545cf59b6f ("MEDIUM: patterns: reorganize pattern reference elements"):
pat_ref_gen_delete()now deletes only the element found bycebs_item_lookup(); it used to walk the duplicates withcebs_item_next_dup(). This affects all callers: CLI del map/acl, del-map/del-acl actions, Lua, acme.pat_ref_purge_range()walks the generations in ascending order and, whenfrom <= to, stops at the first one outside the range even if it is belowfrom.clear map @1passes from = to = 1, so generation 0 stops the loop:if (gen->gen_id - from > to - from) { if (from <= to) { break; } continue; }
Do you have an idea how to solve the issue?
- In
pat_ref_gen_delete(), walk the duplicates aspat_ref_set_from_elt()does, then publish the event once:while (elt) { elt2 = cebs_item_next_dup(&gen->elt_root, node, pattern, elt); pat_ref_delete_by_ptr(ref, elt); elt = elt2; } - In
pat_ref_purge_range(), break only above the range andcontinuebelow it:if (from <= to && gen->gen_id > to) break;.
With both on master, the steps above give the 3.3.16 output and the http-rules, converter, cli and lua reg-tests pass.
What is your configuration?
global
stats socket /tmp/ha.sock mode 600 level admin
frontend fe
mode http
bind 127.0.0.1:18080
timeout client 5s
http-request set-var(txn.v) req.hdr(host),map(dup.map)
Output of haproxy -vv
HAProxy version 3.5-dev8 2026/10/01 - https://haproxy.org/
OPTIONS = USE_OPENSSL= USE_PCRE2=1
Last Outputs and Backtraces
No crash; the commands report success.
Additional Information
Vanilla builds only.
- 主要语言
- C
- 星标
- 6.9k
- 派生
- 976
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
haproxy/haproxy 的其他 Issue
-
type: feature
难度 1/5 1 小时以内 新手友好度 77/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
type: code-report
难度 2/5 1-3 小时 新手友好度 74/100
-
type: code-report
难度 1/5 1 小时以内 新手友好度 82/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
-
area:gates bug good first issue
难度 1/5 1 小时以内 新手友好度 85/100
InauguralSystems/EigenScript#1782 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
intel/intel-device-plugins-for-kubernetes#2384 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
zephyrproject-rtos/zephyr#122261 ·
维护者通常 3 天内回复