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

lbox_select() may leak in case of memory failure #1182

Closed
rtsisyk opened this issue Dec 4, 2015 · 1 comment
Closed

lbox_select() may leak in case of memory failure #1182

rtsisyk opened this issue Dec 4, 2015 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@rtsisyk
Copy link
Contributor

rtsisyk commented Dec 4, 2015

Both lbox_select() (Lua/C) and index:select() (FFI) may leak on a memory failure during re-allocating Lua table with results.

local ret = {}
local entry = port_buf.first
for i=1,tonumber(port_buf.size),1 do
ret[i] = box.tuple.bless(entry.tuple)
entry = entry.next
end
builtin.port_buf_destroy(port_buf);
(see a line with call to port_buf_destroy).

A test case hard to make, however it should be possible.

@rtsisyk rtsisyk added the bug Something isn't working label Dec 4, 2015
rtsisyk added a commit that referenced this issue Dec 4, 2015
Don't allow Lua exceptions inside box_select() callbacks.
A Lua exception may break internal state of box (leak transactions,
pass try-catch handlers in fibers and so on).

Please note that this binding still can leak on OOM.
#1182
@kostja kostja added this to the 1.7.0 milestone Dec 4, 2015
@kostja
Copy link
Contributor

kostja commented Jan 7, 2016

I'm closing this since, given the tests, we're more likely to run out of finalizers first.

@kostja kostja closed this as completed Jan 7, 2016
@kostja kostja modified the milestone: 1.7.0 Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants