Skip to content

Plugin memory leak with TSMutexCreate #5777

@traeak

Description

@traeak

With the stats_over_http intercept handler being called with a continuation created with TSMutexCreate() each call is leaking the mutex. This is new with master and doesn't leak in ats8 or ats7 branches.

The below is the relevant valgrind log for a test run that had the stats_over_http endpoint hit 10 times.

==16953== 880 bytes in 11 blocks are definitely lost in loss record 1,184 of 1,353
==16953==    at 0x4C2BC5C: memalign (vg_replace_malloc.c:857)
==16953==    by 0x4C2BD21: posix_memalign (vg_replace_malloc.c:1020)
==16953==    by 0x4E9EB40: ats_memalign (ink_memory.cc:102)
==16953==    by 0x4EA8844: jearena::JemallocNodumpAllocator::allocate(_InkFreeList*) (JeAllocator.cc:112)
==16953==    by 0x4E9F32C: ink_freelist_new (ink_queue.cc:187)
==16953==    by 0x4F088C: alloc (Allocator.h:131)
==16953==    by 0x4F088C: new_ProxyMutex (I_Lock.h:469)
==16953==    by 0x4F088C: TSMutexCreate (InkIOCoreAPI.cc:244)
==16953==    by 0x1115143F: stats_origin (stats_over_http.c:267)
==16953==    by 0x4D6CD2: INKContInternal::handle_event(int, void*) (InkAPI.cc:1104)
==16953==    by 0x4D7B43: handleEvent (I_Continuation.h:190)
==16953==    by 0x4D7B43: APIHook::invoke(int, void*) (InkAPI.cc:1330)
==16953==    by 0x52F45D: HttpSM::state_api_callout(int, void*) (HttpSM.cc:1456)
==16953==    by 0x5282C3: call_transact_and_set_next_state (HttpSM.cc:7174)
==16953==    by 0x5282C3: HttpSM::state_read_client_request_header(int, void*) (HttpSM.cc:798)
==16953==    by 0x5261F2: HttpSM::main_handler(int, void*) (HttpSM.cc:0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions