Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks in memtx_space_build_index and memtx_space_check_format functions. #8773

Closed
mkostoevr opened this issue Jun 14, 2023 · 0 comments · Fixed by #8795
Closed

Memory leaks in memtx_space_build_index and memtx_space_check_format functions. #8773

mkostoevr opened this issue Jun 14, 2023 · 0 comments · Fixed by #8795
Assignees
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working memtx

Comments

@mkostoevr
Copy link
Contributor

Bug description

The suspects do not free the allocated iterator if txn_check_singlestatement check is failed.

memtx_space_build_index:

memtx_space_check_format:

Rerpducer

box.cfg{memtx_use_mvcc_engine = false}

s = box.schema.space.create('s')
s:create_index('pk', {parts = {{1, 'scalar'}}})
s:create_index('sk', {unique = false, hint = true})

-- Fill spaces to invoke format check/index rebuild.
for i = 1, 10 do s:insert({i, i, i}) end

function memtx_space_build_index_leak()
    print(pcall(function()
        box.begin()
        -- The first index rebuild because of `hint` change.
        s.index.sk:alter({hint = false})
        -- The second index rebuild because of `unique` change.
        s.index.sk:alter({unique = true})
        box.commit()
    end))
    box.rollback()
end

function memtx_space_check_format_leak()
    s.index.sk:alter({parts = {{1, 'scalar'}}})
    print(pcall(function()
        box.begin()
        s:format({{'id', 'scalar'}})
        s:format({{'id', 'number'}})
        s:format({{'id', 'unsigned'}})
        box.commit()
    end))
    box.rollback()
end

memtx_space_check_format_leak()
memtx_space_build_index_leak()

os.exit()
@mkostoevr mkostoevr added bug Something isn't working memtx labels Jun 14, 2023
@CuriousGeorgiy CuriousGeorgiy self-assigned this Jun 20, 2023
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this issue Jun 23, 2023
Space index build and space format checking operations don't destroy space
iterator on `txn_check_singlestatement` failure — fix this.

Closes tarantool#8773

NO_DOC=bugfix
NO_TEST=<leak happens in small, cannot be detected by sanitizer>
locker pushed a commit that referenced this issue Jun 23, 2023
Space index build and space format checking operations don't destroy space
iterator on `txn_check_singlestatement` failure — fix this.

Closes #8773

NO_DOC=bugfix
NO_TEST=<leak happens in small, cannot be detected by sanitizer>
locker pushed a commit that referenced this issue Jun 23, 2023
Space index build and space format checking operations don't destroy space
iterator on `txn_check_singlestatement` failure — fix this.

Closes #8773

NO_DOC=bugfix
NO_TEST=<leak happens in small, cannot be detected by sanitizer>

(cherry picked from commit 6689f51)
locker pushed a commit that referenced this issue Jun 23, 2023
Space index build and space format checking operations don't destroy space
iterator on `txn_check_singlestatement` failure — fix this.

Closes #8773

NO_DOC=bugfix
NO_TEST=<leak happens in small, cannot be detected by sanitizer>

(cherry picked from commit 6689f51)
@locker locker added the 2.10 Target is 2.10 and all newer release/master branches label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working memtx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants