Skip to content

Memory leak on foreign key constraint failure #10476

@nshy

Description

@nshy

Found by ASAN.

Repoducer:

local fiber = require('fiber')
box.cfg{}
local x = box.schema.create_space('x', {format = {
    {'id', 'unsigned'},
    {'ref', 'string'},
}})
x:create_index('pk')
x:create_index('sk', {parts = {'ref'}})
local a = string.rep('a', 512 * 1024)
x:insert({1, a})
local y = box.schema.create_space('y', {format = {
    {'id', 'unsigned'},
    {'ref', 'string', foreign_key = {space = 'x', field = 'ref'}},
}})
y:create_index('pk')
y:create_index('sk', {parts = {'ref'}})
y:insert({1, a})
local b = string.rep('b', 512 * 1024)
while true do
    pcall(x.replace, x, {1, b})
    fiber.yield()
end

The script is killed by OOM killer after several seconds after start:

авг 26 17:23:45 mynote kernel: Out of memory: Killed process 93403 (tarantool) total-vm:21728684kB, anon-rss:10900736kB, file-rss:3396kB, shmem-rss:0kB, UID:1000 pgtables:41380kB oom_score_adj:0

The issue introduced in 2.10.0-beta2-200-gd950fdde47.

Metadata

Metadata

Assignees

Labels

2.11Target is 2.11 and all newer release/master branches3.2Target is 3.2 and all newer release/master branchesbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions