• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 14706628116

28 Apr 2025 11:26AM UTC coverage: 87.496% (-0.003%) from 87.499%
14706628116

push

github

locker
memtx: handle OOM on statement rollback

Currently during statement rollback we either assume that rollback does
not fail or panic on failure. Unfortunately rollback can fail due to OOM
because of opened read view and reservations done for rollback.

Let's handle this situation similar to transaction rollback in [1].
Let's set new transaction flag `TXN_STMT_ROLLBACK` before doing
statement rollback and check it when we need to allocate memory in memtx
arena. If flag is set and memory exhausted then allocate memory outside
the arena.

Handle is added to HASH and TREE indexes. RTREE data structure does not
handle OOM's yet, we have heuristic reservation in RTREE index. BITSET
partially allocates memory using `realloc`.

To test the situation we can add something like
`ERRINJ_INDEX_ALLOC_COUNTDOWN` injection to imitate memory exhausting
during statement execution. But tests with such injection are fragile
- they depend specific pattern of memory allocation in index data
  structure. Instead let's build injection around index data structure
calls using introduced `INDEX_OOM_ERRINJ`. This way we may have
injections that are not possible but it does not hurt. It is not
a problem that we check we handle impossible failures too in tests.

[1] commit 32ea713af0a4 ("box: fix crash on rollback on memtx memory OOM
and massive index change")

Closes #11171

NO_DOC=bugfix

(cherry picked from commit bea61aed3)

70043 of 123901 branches covered (56.53%)

128 of 141 new or added lines in 5 files covered. (90.78%)

42 existing lines in 16 files now uncovered.

103061 of 117789 relevant lines covered (87.5%)

2183282.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.22
/src/lua/fiber.c


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc