Skip to content

drop lsan suppressions#10207

Closed
nshy wants to merge 13 commits intotarantool:masterfrom
nshy:suppressions-prepare
Closed

drop lsan suppressions#10207
nshy wants to merge 13 commits intotarantool:masterfrom
nshy:suppressions-prepare

Conversation

@nshy
Copy link
Contributor

@nshy nshy commented Jul 5, 2024

@nshy nshy requested a review from a team as a code owner July 5, 2024 15:29
@nshy nshy force-pushed the suppressions-prepare branch from 4f16a56 to b710328 Compare July 5, 2024 15:49
@nshy nshy added the asan-ci Enables asan build tests for a pull request label Jul 5, 2024
@coveralls
Copy link

Coverage Status

coverage: 87.166% (+0.08%) from 87.089%
when pulling b710328 on nshy:suppressions-prepare
into 7db4de7
on tarantool:master
.

@nshy nshy force-pushed the suppressions-prepare branch from b710328 to 15e588f Compare July 8, 2024 11:57
@coveralls
Copy link

coveralls commented Jul 8, 2024

Coverage Status

coverage: 87.3% (+0.08%) from 87.219%
when pulling 4bfa9c8 on nshy:suppressions-prepare
into 218fc46
on tarantool:master
.

@nshy nshy force-pushed the suppressions-prepare branch 4 times, most recently from 7470d5e to 3279431 Compare July 12, 2024 15:25
@nshy nshy force-pushed the suppressions-prepare branch from 3279431 to 58d8951 Compare July 15, 2024 15:38
@nshy nshy changed the title draft: drop lsan suppressions drop lsan suppressions Jul 15, 2024
@nshy nshy added the do not merge Not ready to be merged label Jul 15, 2024
@@ -0,0 +1,3 @@
## bugfix/lua

- Fixed iconv object memory leak.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fixed iconv object memory leak.
- Fixed an iconv object memory leak.

@@ -0,0 +1,3 @@
## bugfix/vinyl

- Fixed memory leak in vinyl on dump/compaction failure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fixed memory leak in vinyl on dump/compaction failure.
- Fixed a memory leak in vinyl on dump/compaction failure.

Comment on lines +3 to +9
- Fixed memory leak on disconnectiong from replica.
- Fixed memory leak on user ddl on access check failure.
- Fixed memory leak on xlog open failure.
- Fixed memory leak on space ddl on certain condition.
- Fixed memory leak on iproto override usage (since 3.1).
- Fixed memory leak on ddl failed due to foreign key constraint check.
- Fixed memory leak on space drop with sequence bound to json path.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fixed memory leak on disconnectiong from replica.
- Fixed memory leak on user ddl on access check failure.
- Fixed memory leak on xlog open failure.
- Fixed memory leak on space ddl on certain condition.
- Fixed memory leak on iproto override usage (since 3.1).
- Fixed memory leak on ddl failed due to foreign key constraint check.
- Fixed memory leak on space drop with sequence bound to json path.
- Fixed a memory leak on disconnection from a replica.
- Fixed a memory leak on user DDL on access check failure.
- Fixed a memory leak on `xlog` open failure.
- Fixed a memory leak on space ddl on certain condition.
- Fixed a memory leak on iproto override usage (since 3.1).
- Fixed a memory leak on DDL failed due to foreign key constraint check.
- Fixed a memory leak on space drop with sequence bound to json path.

@nshy nshy force-pushed the suppressions-prepare branch from 58d8951 to c8ee2a4 Compare July 16, 2024 08:10
@nshy nshy requested a review from locker July 16, 2024 09:34
- Fixed memory leak on ddl failed due to foreign key constraint check.
- Fixed memory leak on space drop with sequence bound to json path.

## bugfix/core
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't mix release notes for different subsystems in the same file - gen-release-notes won't combine them properly.

src/box/alter.cc Outdated
alter->new_space->sequence_path = alter->old_space->sequence_path;
if (alter->old_space->sequence_path != NULL)
alter->new_space->sequence_path =
(char *)xstrdup(alter->old_space->sequence_path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split this patch into different commits, for example:

  • Leak on DDL access check failure.
  • Leak on xlog open failure.
  • Leak on iproto override.
  • Leak on replication reconfiguration.
  • Leak on network address resolution error.

Also, it's preferable to submit some fixes in separate PRs because a PR with > 5-7 commits is difficult to review.

#endif

/** If false then LSAN will not be run on Tarantool exit. */
extern bool lsan_enabled;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be defined only if ENABLE_ASAN is set.

}

int
__lsan_is_turned_off(void)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining that this a function called internally by ASAN to check if it should report leaks.

void
swim_gc(struct swim *swim)
{
if (swim->event_handler == NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reference the commit that introduced the leak in the commit message.

Comment on lines +775 to +784
/* tarantool_L is freed on Tarantool shutdown. */
if (L == NULL)
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't box be destroyed before Lua? I don't like that there are so many places now where we have to check tarantool_L.

Comment on lines +1785 to +1943
bool stop = false;
while (!stop)
memtx_engine_run_gc(memtx, &stop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be done when the engine is destroyed, not when we schedule garbage collection.

* Denitialize qsync engine.
*/
void
txn_limbo_destroy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be named txn_limbo_free according to our naming convention. Anyway, there are so many susbystems touched in this commit with so different cases so it may be better to split this commit as well and submit it in a different PR.

# TODO(gh-9213): remove when the issue is fixed
leak:luaT_push_key_def

# TODO(gh-8890): remove when the issue is fixed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add Closes #XXXX to commit messages where applicable. Also, it'd be better if you removed the suppressions in the commits that actually fix the leaks.

@locker locker assigned nshy and unassigned locker Jul 17, 2024
@nshy nshy removed the asan-ci Enables asan build tests for a pull request label Aug 28, 2024
@nshy nshy force-pushed the suppressions-prepare branch 2 times, most recently from 91dfe4c to ff5e624 Compare August 28, 2024 13:14
nshy added 13 commits September 3, 2024 15:16
GC fiber is dead at this point. We don't need to free tuples anyway for
non ASAN builds on shutdown. For ASAN builds let's free tuples in
memtx_engine_free().

Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
Otherwise we got a lot of FP leak reports. We also need to add check if
global Lua state is closed in several places which can be executed after
closing Lua state.

Part-of tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
It was introduced in the commit 446201b ("asan: turn ASAN
allocators on finally"). I probably added `ibuf_destroy` to fix
a memory leak report but `ibuf` is passed from Lua so it is garbage
collected by Lua. We don't have issues with double free probably
because we don't close Lua on Tarantool exit until now.

Part-of tarantool#10211

NO_CHANGELOG=internal
NO_DOC=internal
On Tarantool shutdown first swim worker fiber is finished as managed on
shutdown one. So later when swim is collected we got crash in swim_gc()
because `event_handler` is NULL at this point. There is no worker fiber
so we need to free swim synchronously.

The issue was hidden because we do not call lua_close() earlier. It had
little change to occur. Now it is revealed.

Closes tarantool#10495
Part-of tarantool#10211

NO_TEST=covered by existing tests
NO_DOC=bugfix
Introduced in the commit ab3746b ("gc: persist WAL GC consumers").

Part-of tarantool#10211

NO_TEST=covered by existing tests
NO_CHANGELOG=not released
NO_DOC=bugfix
Closes tarantool#10211

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
@nshy
Copy link
Contributor Author

nshy commented Sep 4, 2024

Closed as superseded by #10475 #10491 #10500 #10505 #10516.

@nshy nshy closed this Sep 4, 2024
@nshy nshy deleted the suppressions-prepare branch September 9, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asan-ci Enables asan build tests for a pull request do not merge Not ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants