Skip to content

Memory leak in MIMEScanner #5604

Description

@zwoop

Seeing this on Docs:

==2769==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 141440 byte(s) in 1008 object(s) allocated from:
    #0 0x2b5981b401a8 in operator new(unsigned long) (/lib64/libasan.so.4+0xe01a8)
    #1 0x558112 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /opt/rh/devtoolset-7/root/usr/include/c++/7/ext/new_
allocator.h:111
    #2 0x558112 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) /opt/rh/devtoolset-7/root/usr/inc
lude/c++/7/bits/basic_string.tcc:1057
    #3 0x558112 in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/
basic_string.tcc:1078
    #4 0x558112 in std::string::reserve(unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:960
    #5 0x9f08a4 in std::string::append(char const*, unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:758
    #6 0x9f08a4 in std::enable_if<std::__and_<std::is_convertible<ts::TextView const&, std::basic_string_view<char, std::char_traits<char> >
 >, std::__not_<std::is_convertible<ts::TextView const*, std::string const*> >, std::__not_<std::is_convertible<ts::TextView const&, char co
nst*> > >::value, std::string&>::type std::string::append<ts::TextView>(ts::TextView const&) /opt/rh/devtoolset-7/root/usr/include/c++/7/bit
s/basic_string.h:4207
    #7 0x9f08a4 in std::enable_if<std::__and_<std::is_convertible<ts::TextView const&, std::basic_string_view<char, std::char_traits<char> >
 >, std::__not_<std::is_convertible<ts::TextView const*, std::string const*> >, std::__not_<std::is_convertible<ts::TextView const&, char co
nst*> > >::value, std::string&>::type std::string::operator+=<ts::TextView>(ts::TextView const&) /opt/rh/devtoolset-7/root/usr/include/c++/7
/bits/basic_string.h:4113
    #8 0x9f08a4 in MIMEScanner::append(ts::TextView) /usr/local/src/trafficserver/proxy/hdrs/MIME.cc:2324
    #9 0x9f08a4 in MIMEScanner::get(ts::TextView&, ts::TextView&, bool&, bool, MIMEScanner::ScanType) /usr/local/src/trafficserver/proxy/hdr
s/MIME.cc:2444
    #10 0x9f08a4 in mime_parser_parse(MIMEParser*, HdrHeap*, MIMEHdrImpl*, char const**, char const*, bool, bool) /usr/local/src/trafficserv
er/proxy/hdrs/MIME.cc:2508
    #11 0x9a7fa8 in http_parser_parse_req(HTTPParser*, HdrHeap*, HTTPHdrImpl*, char const**, char const*, bool, bool, bool) /usr/local/src/t
rafficserver/proxy/hdrs/HTTP.cc:1135
    #12 0x9b9a05 in HTTPHdr::parse_req(HTTPParser*, IOBufferReader*, int*, bool, bool) /usr/local/src/trafficserver/proxy/hdrs/HdrTSOnly.cc:
74
    #13 0x6b6398 in HttpSM::state_read_client_request_header(int, void*) /usr/local/src/trafficserver/proxy/http/HttpSM.cc:658
    #14 0x6d3f76 in HttpSM::main_handler(int, void*) /usr/local/src/trafficserver/proxy/http/HttpSM.cc:2584
    #15 0xdba2f0 in Continuation::handleEvent(int, void*) /usr/local/src/trafficserver/iocore/eventsystem/I_Continuation.h:190
    #16 0xdba2f0 in read_signal_and_update /usr/local/src/trafficserver/iocore/net/UnixNetVConnection.cc:83
    #17 0xdba2f0 in UnixNetVConnection::readSignalAndUpdate(int) /usr/local/src/trafficserver/iocore/net/UnixNetVConnection.cc:1006

and

Direct leak of 70559 byte(s) in 61 object(s) allocated from:
    #0 0x2b5981b401a8 in operator new(unsigned long) (/lib64/libasan.so.4+0xe01a8)
    #1 0x558112 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /opt/rh/devtoolset-7/root/usr/include/c++/7/ext/new_
allocator.h:111
    #2 0x558112 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) /opt/rh/devtoolset-7/root/usr/inc
lude/c++/7/bits/basic_string.tcc:1057
    #3 0x558112 in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/
basic_string.tcc:1078
    #4 0x558112 in std::string::reserve(unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:960
    #5 0x9f08a4 in std::string::append(char const*, unsigned long) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:758
    #6 0x9f08a4 in std::enable_if<std::__and_<std::is_convertible<ts::TextView const&, std::basic_string_view<char, std::char_traits<char> > >, std::__not_<std::is_convertible<ts::TextView const*, std::string const*> >, std::__not_<std::is_convertible<ts::TextView const&, char const*> > >::value, std::string&>::type std::string::append<ts::TextView>(ts::TextView const&) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4207
    #7 0x9f08a4 in std::enable_if<std::__and_<std::is_convertible<ts::TextView const&, std::basic_string_view<char, std::char_traits<char> > >, std::__not_<std::is_convertible<ts::TextView const*, std::string const*> >, std::__not_<std::is_convertible<ts::TextView const&, char const*> > >::value, std::string&>::type std::string::operator+=<ts::TextView>(ts::TextView const&) /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4113
    #8 0x9f08a4 in MIMEScanner::append(ts::TextView) /usr/local/src/trafficserver/proxy/hdrs/MIME.cc:2324
    #9 0x9f08a4 in MIMEScanner::get(ts::TextView&, ts::TextView&, bool&, bool, MIMEScanner::ScanType) /usr/local/src/trafficserver/proxy/hdrs/MIME.cc:2444
    #10 0x9f08a4 in mime_parser_parse(MIMEParser*, HdrHeap*, MIMEHdrImpl*, char const**, char const*, bool, bool) /usr/local/src/trafficserver/proxy/hdrs/MIME.cc:2508
    #11 0x9a7fa8 in http_parser_parse_req(HTTPParser*, HdrHeap*, HTTPHdrImpl*, char const**, char const*, bool, bool, bool) /usr/local/src/trafficserver/proxy/hdrs/HTTP.cc:1135
    #12 0x9b9a05 in HTTPHdr::parse_req(HTTPParser*, IOBufferReader*, int*, bool, bool) /usr/local/src/trafficserver/proxy/hdrs/HdrTSOnly.cc:74
    #13 0x6b6398 in HttpSM::state_read_client_request_header(int, void*) /usr/local/src/trafficserver/proxy/http/HttpSM.cc:658
    #14 0x6d3f76 in HttpSM::main_handler(int, void*) /usr/local/src/trafficserver/proxy/http/HttpSM.cc:2584
    #15 0xdaf620 in Continuation::handleEvent(int, void*) /usr/local/src/trafficserver/iocore/eventsystem/I_Continuation.h:190
    #16 0xdaf620 in read_signal_and_update /usr/local/src/trafficserver/iocore/net/UnixNetVConnection.cc:83
    #17 0xdc4096 in read_from_net /usr/local/src/trafficserver/iocore/net/UnixNetVConnection.cc:309
    #18 0xd7bdea in NetHandler::process_ready_list() /usr/local/src/trafficserver/iocore/net/UnixNet.cc:395
    #19 0xd7c9e8 in NetHandler::waitForActivity(long) /usr/local/src/trafficserver/iocore/net/UnixNet.cc:528

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions