Skip to content

memleak on AI.DAGRUN -- RedisAI_RunInfo and RAI_ModelRunCtx data structures are not being fully freed #411

Closed
@filipecosta90

Description

@filipecosta90

use the branch sanitizer-dagrun and a redis-server compiled with glibc allocator.

To check the leak on AI.DAGRUN variant:

DEBUG=1 VALGRIND=1 make -C opt clean && VALGRIND=1 WITH_TFLITE=0 WITH_ORT=0 DEBUG=1 SLAVES=0 AOF=0 make -C opt test TEST=tests_sanitizer:test_sanitizer_dagrun_mobilenet_v1

important leak info:

(...)
==23988== 602,437 (96 direct, 602,341 indirect) bytes in 1 blocks are definitely lost in loss record 120,098 of 120,103
==23988==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23988==    by 0x67CA3E2: AI_dictCreate (dict.c:149)
==23988==    by 0x67D7297: RAI_InitRunInfo (run_info.c:79)
==23988==    by 0x67E37B5: RedisAI_DagRun_syntax_parser (dag.c:382)
==23988==    by 0x67D3063: RedisAI_DagRun_RedisCommand (redisai.c:887)
==23988==    by 0x1BA92B: RedisModuleCommandDispatcher (module.c:642)
==23988==    by 0x142BDA: call (server.c:3268)
==23988==    by 0x14360C: processCommand (server.c:3652)
==23988==    by 0x15127F: processCommandAndResetClient (networking.c:1785)
==23988==    by 0x155BDE: processInputBuffer (networking.c:1867)
==23988==    by 0x1D55D9: callHandler (connhelpers.h:79)
==23988==    by 0x1D55D9: connSocketEventHandler (connection.c:281)
==23988==    by 0x13C062: aeProcessEvents (ae.c:479)
==23988== 
==23988== 1,949,886 (32 direct, 1,949,854 indirect) bytes in 1 blocks are definitely lost in loss record 120,099 of 120,103
==23988==    at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23988==    by 0x14A995: zcalloc (zmalloc.c:131)
==23988==    by 0x67EB3C7: RAI_ModelRunCtxCreate (model.c:347)
==23988==    by 0x67E3CC8: RedisAI_DagRun_syntax_parser (dag.c:474)
==23988==    by 0x67D3063: RedisAI_DagRun_RedisCommand (redisai.c:887)
==23988==    by 0x1BA92B: RedisModuleCommandDispatcher (module.c:642)
==23988==    by 0x142BDA: call (server.c:3268)
==23988==    by 0x14360C: processCommand (server.c:3652)
==23988==    by 0x15127F: processCommandAndResetClient (networking.c:1785)
==23988==    by 0x155BDE: processInputBuffer (networking.c:1867)
==23988==    by 0x1D55D9: callHandler (connhelpers.h:79)
==23988==    by 0x1D55D9: connSocketEventHandler (connection.c:281)
==23988==    by 0x13C062: aeProcessEvents (ae.c:479)
==23988== 

To confirm that the AI.MODELRUN variant does not present this leak:

DEBUG=1 VALGRIND=1 make -C opt clean && VALGRIND=1 WITH_TFLITE=0 WITH_ORT=0 DEBUG=1 SLAVES=0 AOF=0 make -C opt test TEST=tests_sanitizer:test_sanitizer_modelrun_mobilenet_v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions