-
Notifications
You must be signed in to change notification settings - Fork 375
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
iproto.eval + box.session.storage == memory leak #3279
Comments
box.session.storage destructor is broken: > c = 0 for sid in pairs(getmetatable(box.session).aggregate_storage) do if not box.session.exists(sid) then c = c + 1 end end
---
...
> c
---
- 12602 |
cleanup test case: #!/usr/bin/tarantool
box.cfg{ listen = 3302 }
box.schema.user.create('test', { password = 'test', if_not_exists = true })
box.schema.user.grant('test', 'read,write,execute', 'universe', nil, {if_not_exists=true})
local r = require 'net.box'
local log = require 'log'
local fiber = require 'fiber'
local json = require 'json'
local uri = 'test:test@localhost:3302'
local no = 0
while true do
local c = r.connect(uri)
c:eval [[
for i = 1, 10000 do
box.session.storage[i] = math.random()
end
]]
no = no + 1
if no % 1000 == 0 then
local info = box.runtime.info()
log.info('%6d: Lua mem: %10d, used: %10d',
no / 1000, info.lua, info.used)
end
if no % 10000 == 0 then
log.info('%6d: Collecting garbage', no / 1000)
collectgarbage('collect')
end
c:close()
end
result: 2018-03-25 18:47:57.889 [29750] main/101/leak.lua C> version 1.7.2-388-g51c2d55
2018-03-25 18:47:57.889 [29750] main/101/leak.lua C> log level 5
2018-03-25 18:47:57.889 [29750] main/101/leak.lua I> mapping 1073741824 bytes for tuple arena...
2018-03-25 18:47:57.890 [29750] main/101/leak.lua I> recovery start
2018-03-25 18:47:57.890 [29750] main/101/leak.lua I> recovering from `./00000000000000000000.snap'
2018-03-25 18:47:57.893 [29750] main/101/leak.lua I> recover from `./00000000000000000000.xlog'
2018-03-25 18:47:57.893 [29750] main/101/leak.lua I> done `./00000000000000000000.xlog'
2018-03-25 18:47:57.893 [29750] main/101/leak.lua I> recover from `./00000000000000000002.xlog'
2018-03-25 18:47:57.894 [29750] main/101/leak.lua I> done `./00000000000000000002.xlog'
2018-03-25 18:47:57.894 [29750] main/102/hot_standby I> recover from `./00000000000000000002.xlog'
2018-03-25 18:47:57.894 [29750] iproto/102/iproto I> binary: started
2018-03-25 18:47:57.895 [29750] iproto/102/iproto I> binary: bound to 0.0.0.0:3302
2018-03-25 18:47:57.895 [29750] main/101/leak.lua I> done `./00000000000000000002.xlog'
2018-03-25 18:47:57.895 [29750] main/101/leak.lua I> ready to accept requests
2018-03-25 18:47:59.846 [29750] main/101/leak.lua I> 1: Lua mem: 133597306, used: 12582912
2018-03-25 18:48:01.670 [29750] main/101/leak.lua I> 2: Lua mem: 276262724, used: 12582912
2018-03-25 18:48:03.347 [29750] main/101/leak.lua I> 3: Lua mem: 451157223, used: 12582912
2018-03-25 18:48:05.201 [29750] main/101/leak.lua I> 4: Lua mem: 569303284, used: 12582912
2018-03-25 18:48:07.041 [29750] main/101/leak.lua I> 5: Lua mem: 744340031, used: 12582912
2018-03-25 18:48:09.111 [29750] main/101/leak.lua I> 6: Lua mem: 819163529, used: 12582912
2018-03-25 18:48:11.013 [29750] main/101/leak.lua I> 7: Lua mem: 994217584, used: 12582912
2018-03-25 18:48:12.689 [29750] main/101/leak.lua I> 8: Lua mem: 1168973874, used: 12582912
2018-03-25 18:48:14.510 [29750] main/101/leak.lua I> 9: Lua mem: 1344191076, used: 12582912
2018-03-25 18:48:16.696 [29750] main/101/leak.lua I> 10: Lua mem: 1342927643, used: 12582912
2018-03-25 18:48:16.696 [29750] main/101/leak.lua I> 10: Collecting garbage
2018-03-25 18:48:18.643 [29750] main/101/leak.lua I> 11: Lua mem: 1487792468, used: 12582912
2018-03-25 18:48:20.410 [29750] main/101/leak.lua I> 12: Lua mem: 1662641843, used: 12582912
2018-03-25 18:48:22.167 [29750] main/101/leak.lua I> 13: Lua mem: 1837843241, used: 12582912
2018-03-25 18:48:23.571 [29750] main/101/leak.lua F> not enough memory
|
GeorgyKirichenko
pushed a commit
that referenced
this issue
Mar 27, 2018
* session_run_on_disconnect_triggers is called only if there are corresponding triggers so move session_storage_cleanup to session_destroy. * fix session storage cleanup path: use "box.session.aggregate_storage[sid]" instead of "session.aggregate_storage[sid]" (what was wrong) Fixed #3279
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my connector uses iproto.eval to add some service fucntions into box.session.storage.
So each version of my app uses its own functions.
Yesterday my app was crashed (see fault trace).
I wrote a testcase to reproduce the problem:
log of the script:
The bug is not in net.box, because I stubmled on the bug through perl connector.
The text was updated successfully, but these errors were encountered: