masaori335 opened a new issue, #10541:
URL: https://github.com/apache/trafficserver/issues/10541

   As part of #10539, trying fix of memory leak in the 
`test_http_hdr_print_and_copy_aux`, I faced a crash.
   
   The leak trying to fix
   
   ```
   ==26521==ERROR: LeakSanitizer: detected memory leaks
   
   Direct leak of 14336 byte(s) in 7 object(s) allocated from:
       #0 0x5591d1c59c9d in aligned_alloc 
(/workspace/proxy/hdrs/.libs/test_proxy_hdrs+0xcbc9d) (BuildId: 
1e34a10e595cf9e4b7f649457b87d110220a4d1b)
       #1 0x5591d1d08ddc in MallocAllocator::alloc_void() 
/workspace/iocore/eventsystem/../../include/tscore/Allocator.h:141:13
       #2 0x5591d1d08ddc in thread_alloc(MallocAllocator&, ProxyAllocator&) 
/workspace/iocore/eventsystem/ProxyAllocator.cc:38:12
       #3 0x5591d1cf0205 in new_HdrHeap(int) 
/workspace/proxy/hdrs/HdrHeap.cc:114:35
       #4 0x5591d1cd3ffc in HTTPHdr::create(HTTPType, HTTPVersion, HdrHeap*) 
/workspace/proxy/hdrs/./HTTP.h:700:14
       #5 0x5591d1cd3ffc in (anonymous 
namespace)::test_http_hdr_print_and_copy_aux(int, char const*, char const*, 
char const*, char const*) /workspace/proxy/hdrs/unit_tests/test_Hdrs.cc:413:15
       #6 0x5591d1cd3ffc in C_A_T_C_H_T_E_S_T_4() 
/workspace/proxy/hdrs/unit_tests/test_Hdrs.cc:1191:20
       #7 0x5591d1c73cfe in Catch::TestCase::invoke() const 
/workspace/lib/catch2/catch.hpp:14167:15
       #8 0x5591d1c73cfe in Catch::RunContext::invokeActiveTestCase() 
/workspace/lib/catch2/catch.hpp:13027:27
       #9 0x5591d1c73cfe in 
Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char>>&, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char>>&) /workspace/lib/catch2/catch.hpp:13000:17
       #10 0x5591d1c7320e in Catch::RunContext::runTest(Catch::TestCase const&) 
/workspace/lib/catch2/catch.hpp:12761:13
       #11 0x5591d1c79663 in Catch::(anonymous namespace)::TestGroup::execute() 
/workspace/lib/catch2/catch.hpp:13354:45
       #12 0x5591d1c79663 in Catch::Session::runInternal() 
/workspace/lib/catch2/catch.hpp:13560:39
       #13 0x5591d1c78358 in Catch::Session::run() 
/workspace/lib/catch2/catch.hpp:13516:24
       #14 0x5591d1c90f57 in int Catch::Session::run<char>(int, char const* 
const*) /workspace/lib/catch2/catch.hpp:13238:30
       #15 0x5591d1c90f57 in main 
/workspace/proxy/hdrs/unit_tests/unit_test_main.cc:41:33
       #16 0x7f52e958aa8f  (/lib/x86_64-linux-gnu/libc.so.6+0x23a8f) (BuildId: 
bdb8aa3b1b60f9d43e1c70ba98158e05f765efdc)
   
   SUMMARY: LeakSanitizer: 14336 byte(s) leaked in 7 allocation(s).
   ```
   
   The patch I tried
   
   ```
   diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc 
b/proxy/hdrs/unit_tests/test_Hdrs.cc
   index 265edb099..21ce0b957 100644
   --- a/proxy/hdrs/unit_tests/test_Hdrs.cc
   +++ b/proxy/hdrs/unit_tests/test_Hdrs.cc
   @@ -451,6 +451,7 @@ test_http_hdr_print_and_copy_aux(int testnum, const char 
*request, const char *r
   
      hdr.destroy();
      new_hdr.destroy();
   +  marshal_hdr.destroy();
   
      /*** (4) parse the response string into hdr ***/
   ```   
   
   The crash
   
   ```
   LeakSanitizer: bad pointer 0x7fffffffdb20
   LeakSanitizer: CHECK failed: sanitizer_allocator_secondary.h:177 
"((IsAligned(reinterpret_cast<uptr>(p), page_size_))) != (0)" (0x0, 0x0) 
(tid=26412)
   Process 26412 exited with status = 23 (0x00000017)
   ```


-- 
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]

Reply via email to