Skip to content

vinyl: fix memory leak on error decoding row during compaction#11051

Merged
locker merged 1 commit intotarantool:masterfrom
locker:gh-11044-vy-page-leak-fix
Jan 27, 2025
Merged

vinyl: fix memory leak on error decoding row during compaction#11051
locker merged 1 commit intotarantool:masterfrom
locker:gh-11044-vy-page-leak-fix

Conversation

@locker
Copy link
Member

@locker locker commented Jan 24, 2025

Just add missing vy_page_delete() to vy_slice_stream_search().

The error is very unlikely to happen because:

  • vy_slice_stream_search() is called only once during a compaction task execution.
  • Memory leaks if vy_page_find_key() fails to decode a statement. Practically, this can only occur on memory allocation error. In tests it's triggered by an error injection.

Closes #11044

Just add missing `vy_page_delete()` to `vy_slice_stream_search()`.

The error is very unlikely to happen because:
 - `vy_slice_stream_search()` is called only once during a compaction
   task execution.
 - Memory leaks if `vy_page_find_key()` fails to decode a statement.
   Practically, this can only occur on memory allocation error.
   In tests it's triggered by an error injection.

Closes tarantool#11044

NO_DOC=bug fix
NO_TEST=caught by existing test now and then
NO_CHANGELOG=minor; shouldn't normally happen
@coveralls
Copy link

Coverage Status

coverage: 87.363% (-0.007%) from 87.37%
when pulling adc9042 on locker:gh-11044-vy-page-leak-fix
into 437f2fa
on tarantool:master
.

@locker locker requested a review from nshy January 24, 2025 15:23
@Gerold103
Copy link
Collaborator

This wouldn't have happened with C++ and RAII 😉😂.

@nshy nshy assigned locker and unassigned nshy Jan 27, 2025
@locker locker added the full-ci Enables all tests for a pull request label Jan 27, 2025
@locker locker merged commit 36dbd4a into tarantool:master Jan 27, 2025
95 checks passed
@locker locker deleted the gh-11044-vy-page-leak-fix branch January 27, 2025 11:14
@locker
Copy link
Member Author

locker commented Jan 27, 2025

Cherry-picked to 2.11, 3.2, 3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Enables all tests for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indirect leak of 4 byte(s) in 1 object(s) allocated in vinyl source code

4 participants