← Back to team overview

maria-developers team mailing list archive

Re: [JIRA] (MDEV-17260) Memory leaks in mysqlbinlog

 

Sujatha, hello.

The patches look good though I have a concern in ..

>     [ https://jira.mariadb.org/browse/MDEV-17260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=126440#comment-126440 ] 
>
> Sujatha Sivakumar commented on MDEV-17260:
> ------------------------------------------
>
> In the above report there are three different kinds of leaks were observed.
>
> In 5.5:
> =====
> CURRENT_TEST: rpl.rpl_row_mysqlbinlog
> ================================================================
> ==8988==ERROR: LeakSanitizer: detected memory leaks
> Direct leak of 112 byte(s) in 1 object(s) allocated from:
>  #0 0x4eff87 in __interceptor_malloc (/dev/shm/5.5/client/mysqlbinlog+0x4eff87)
>  #1 0x60eaab in my_malloc /mariadb/5.5/mysys/my_malloc.c:41:10
>  #2 0x5300dd in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*, char) /mariadb/5.5/sql/log_event.cc:1568:12
>  #3 0x564a9c in dump_remote_log_entries(st_print_event_info*, char const*) /mariadb/5.5/client/mysqlbinlog.cc:1978:17
>  #4 0x536408 in dump_log_entries(char const*) /mariadb/5.5/client/mysqlbinlog.cc:1794:21
>  #5 0x535e4b in main /mariadb/5.5/client/mysqlbinlog.cc:2505:18
>  #6 0x7f71ea0a1b16 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x22b16)
>
> This issue exists only in 5.5. It is specific to fake rotate events while reading binary log from a remote server. 
> This issues is already fixed in MariaDB 10.0.23 and higher versions as part of
> commit c3018b0ff4fb02c029787d03867adf0530607bab
>
> 10.2 and above:
> =============
> 1) Leak in Log_event::read_log_event(char const*, unsigned int, char const**,
>    Format_description_log_event const*, char)
>    File: sql/log_event.cc:2150

.. in 2).

> 2) read_remote_annotate_event(unsigned char*, unsigned long, char const**)
>    File: client/mysqlbinlog.cc:194
>

What would you think could be the reason of the being deleted two-liner:

@@ -1539,10 +1539,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
       }
     }
 
-    if (remote_opt)
-      ev->temp_buf= 0;

I see there were done as a part of the flashback feature.
Do we have the flashback and remote combination in any test?

Cheers,

Andrei



> These were caused because of flashback feature and its related bug fixes.
>
> To reproduce the failures use:
>
> ASAN_OPTIONS=abort_on_error=1 ./mtr --parallel=auto binlog.binlog_row_mysqlbinlog_verbose binlog_encryption.binlog_row_annotate binlog.binlog_row_mysqlbinlog_options binlog.binlog_row_annotate encryption.tempfiles binlog.binlog_mysqlbinlog_row_myisam binlog.binlog_mysqlbinlog_row binlog.binlog_mysqlbinlog_base64 binlog_encryption.rpl_skip_replication binlog.binlog_mysqlbinlog_row_innodb binlog.flashback 
>
>> Memory leaks in mysqlbinlog
>> ---------------------------
>>
>>                 Key: MDEV-17260
>>                 URL: https://jira.mariadb.org/browse/MDEV-17260
>>             Project: MariaDB Server
>>          Issue Type: Bug
>>          Components: Scripts & Clients
>>    Affects Versions: 10.0, 10.1, 10.2, 10.3, 10.4, 5.5.62
>>            Reporter: Marko Mäkelä
>>            Assignee: Sujatha Sivakumar
>>            Priority: Major
>>              Labels: ASAN, Memory_leak, valgrind
>>             Fix For: 10.1, 10.2, 10.3, 10.4
>>
>>         Attachments: mdev-17260-wip.patch
>>
>>          Time Spent: 5h
>>  Remaining Estimate: 0d
>>
>> The {{mysqlbinlog}} tool is leaking memory, causing failures in various tests when compiling and testing with AddressSanitizer or LeakSanitizer like this:
>> {code:sh}
>> cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_ASAN:BOOL=ON /path/to/source
>> make -j$(nproc)
>> cd mysql-test
>> ASAN_OPTIONS=abort_on_error=1 ./mtr --parallel=auto
>> {code}
>> {noformat:title=5.5 e07118946a82af60c7cc3804c321d3fd9a49f128}
>> CURRENT_TEST: rpl.rpl_row_mysqlbinlog
>> =================================================================
>> ==8988==ERROR: LeakSanitizer: detected memory leaks
>> Direct leak of 112 byte(s) in 1 object(s) allocated from:
>>     #0 0x4eff87 in __interceptor_malloc (/dev/shm/5.5/client/mysqlbinlog+0x4eff87)
>>     #1 0x60eaab in my_malloc /mariadb/5.5/mysys/my_malloc.c:41:10
>>     #2 0x5300dd in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*, char) /mariadb/5.5/sql/log_event.cc:1568:12
>>     #3 0x564a9c in dump_remote_log_entries(st_print_event_info*, char const*) /mariadb/5.5/client/mysqlbinlog.cc:1978:17
>>     #4 0x536408 in dump_log_entries(char const*) /mariadb/5.5/client/mysqlbinlog.cc:1794:21
>>     #5 0x535e4b in main /mariadb/5.5/client/mysqlbinlog.cc:2505:18
>>     #6 0x7f71ea0a1b16 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x22b16)
>> {noformat}
>
>
>
> --
> This message was sent by Atlassian Jira
> (v7.13.1#713001)