bryancall opened a new pull request, #14047: URL: https://github.com/apache/trafficserver/pull/14047
The master clang_analyzer nightly has failed in all 10 runs Jenkins still keeps ([1351](https://ci.trafficserver.apache.org/job/master/job/clang_analyzer/1351/) to [1360](https://ci.trafficserver.apache.org/job/master/job/clang_analyzer/1360/), 11/04 to 11/10). Every run reports the same four warnings and nothing else: `cplusplus.NewDeleteLeaks` "Potential leak of memory pointed to by field '_M_pi'", two at the closing brace of `ConfigContext::set_supplied_yaml()` and two at `set_reload_directives()`. The last green run, [1338](https://ci.trafficserver.apache.org/job/master/job/clang_analyzer/1338/) on 10/27, predates [#13904](https://github.com/apache/trafficserver/pull/13904), which added those setters on 10/28. There is no leak. The setters chose the new payload with a `?:` between two `make_shared()` temporaries, and against the libstdc++ 11 headers the analyzer reports the shared_ptr allocation as leaked. The nightly runs Clang 14 on Ubuntu 22.04, which has those headers. Clang 18 and Clang 21 report the same warnings against the same headers, so a newer analyzer alone does not clear it. The pull request check missed it because it runs Clang 21 on Ubuntu 26.04, whose libstdc++ 15 headers do not trigger it. This change builds the new `Payload` as a local value and wraps it in one `make_shared<Payload const>()`. Behavior is unchanged: the new payload still copies the old node handles, `emplace()` still replaces only the field being set, and the payload that other holders may still share is never modified. A comment explains why the code has this shape, so the `?:` does not come back. Testing: - The nightly's own check, run in its image (`ci.trafficserver.apache.org/ats/ubuntu:22.04`) with its preset (`branch-clang-analyzer`) and its exact `analyze-build-14` checker flags, over the whole compilation database (724 translation units). On master it reports the same 4 warnings as the nightly and exits 2. With this change it reports nothing and exits 0. No translation unit failed to analyze in either run. - The Clang 18 and Clang 21 analyzers, still on the Ubuntu 22.04 headers, on the same compile command for `ConfigContext.cc`: 4 warnings on master, none with this change. - The `-Werror` build passes. - Under AddressSanitizer with leak detection, on master and with this change: `test_records "[config]"` (47 test cases, 198 assertions, including the 7 `[payload]` cases) and `test_ConfigReloadProgress` (3 test cases, 19 assertions) pass with no LeakSanitizer reports. They call both setters through `ConfigRegistry::apply_passed_config()`, which sets directives and then content, so they cover setting content on a context that already has directives. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
