Fix WAF Encoder child miscount bug#8617
Conversation
BenchmarksBenchmark execution time: 2026-05-13 14:21:31 Comparing candidate commit a421430 in PR branch Some scenarios are present only in baseline or only in candidate runs. If you didn't create or remove some scenarios in your branch, this maybe a sign of crashed benchmarks 💥💥💥 Scenarios present only in baseline:
Found 6 performance improvements and 2 performance regressions! Performance is the same for 48 metrics, 16 unstable metrics, 89 known flaky benchmarks, 37 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8617) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (75ms) : 70, 79
master - mean (74ms) : 70, 77
section Bailout
This PR (8617) - mean (78ms) : 74, 82
master - mean (78ms) : 75, 80
section CallTarget+Inlining+NGEN
This PR (8617) - mean (1,098ms) : 1041, 1155
master - mean (1,100ms) : 1038, 1163
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (116ms) : 110, 122
master - mean (114ms) : 111, 118
section Bailout
This PR (8617) - mean (115ms) : 113, 118
master - mean (117ms) : 114, 119
section CallTarget+Inlining+NGEN
This PR (8617) - mean (792ms) : 764, 821
master - mean (787ms) : 764, 810
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (101ms) : 97, 105
master - mean (106ms) : 100, 112
section Bailout
This PR (8617) - mean (102ms) : 98, 106
master - mean (103ms) : 98, 107
section CallTarget+Inlining+NGEN
This PR (8617) - mean (946ms) : 913, 979
master - mean (944ms) : 906, 982
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (103ms) : 98, 109
master - mean (101ms) : 96, 107
section Bailout
This PR (8617) - mean (102ms) : 100, 105
master - mean (106ms) : 100, 111
section CallTarget+Inlining+NGEN
This PR (8617) - mean (828ms) : 785, 871
master - mean (828ms) : 790, 866
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (190ms) : 187, 194
master - mean (192ms) : 189, 195
section Bailout
This PR (8617) - mean (193ms) : 192, 195
master - mean (195ms) : 193, 197
section CallTarget+Inlining+NGEN
This PR (8617) - mean (1,165ms) : 1122, 1207
master - mean (1,166ms) : 1130, 1202
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (272ms) : 267, 277
master - mean (274ms) : 271, 277
section Bailout
This PR (8617) - mean (272ms) : 269, 275
master - mean (276ms) : 267, 285
section CallTarget+Inlining+NGEN
This PR (8617) - mean (927ms) : 910, 945
master - mean (939ms) : 910, 967
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (266ms) : 262, 270
master - mean (269ms) : 263, 275
section Bailout
This PR (8617) - mean (266ms) : 263, 269
master - mean (276ms) : 268, 284
section CallTarget+Inlining+NGEN
This PR (8617) - mean (1,124ms) : 1060, 1188
master - mean (1,129ms) : 1074, 1183
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8617) - mean (264ms) : 261, 267
master - mean (270ms) : 259, 280
section Bailout
This PR (8617) - mean (264ms) : 262, 266
master - mean (274ms) : 258, 290
section CallTarget+Inlining+NGEN
This PR (8617) - mean (1,021ms) : 982, 1060
master - mean (1,025ms) : 978, 1072
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 10 occurrences of : - _dd.appsec.fp.http.endpoint: http-get-9ce5b35c-2e4a7b5a-,
+ _dd.appsec.fp.http.endpoint: http-get-9ce5b35c-8e35c2cd-,
|
Summary of changes
Fixes a miscount issue with the WAF encoder
Reason for change
#5587 refactored the WAF encoder code, but there's a bug.
ProcessKeyValuePairscalculateschildrenCountonce, callsEnumerateIDictionaryItems, and then setsNbEntriesusing the unmodifiedchildrenCount.EnumerateIDictionaryItemsskips empty keys, and decrementschildrenCount, but it's working on a local copy of the value, soProcessKeyValuePairsdoesn't see the change, meaning it sends too high a value inddWafObjectMap.NbEntriesImplementation details
Pass
childrenCountbyref, so that decrementing it correctly decrements the "global" value.Test coverage
Added some unit tests that demonstrate the issue. These caused errors in the LegacyEncoder paths which similarly were addressed. The change in the snapshots is due to now skipping empty keys
Other details
This was 🤖 identified - I find this code pretty hard to follow, so please do sense check that the change actually makes sense 😅