• Sujatha's avatar
    MDEV-22806: MSAN reports use-of-uninitialized-value for rpl_parallel_conflicts.test · 3bc89395
    Sujatha authored
    Problem:
    ========
    Relay_log_info::flush reports following MSAN issue.
    ==17820==WARNING: MemorySanitizer: use-of-uninitialized-value is reported
    #5  0x00005584f0981441 in my_write (Filedes=22,
    Buffer=0x72500003e818 "5\n./slave-relay-bin.000003\n21385\n
    master-bin.000001\n21643\n0\n", '\245' <repeats 141 times>..., Count=118,
    MyFlags=532) at /home/sujatha/bug_repo/test-10.5-msan/mysys/my_write.c:49
    
    Analysis:
    =========
    In parallel replication at the end of each statement execution the worker execution
    status is updated in 'relay-log.info' file. When two workers try to flush
    the status at the same time, since the write to cache is not serialized both
    workers write to the same address simultaneously and increment the
    length twice. Because of this the length of buffer is more than actual data.
    When flush code tries to read the buffer beyond valid data length MSAN
    reports uninitialized values error.
    
    Fix:
    ===
    Serialize the relay log flush operation using "rli->data_lock".
    3bc89395
rpl_rli.cc 71.8 KB