mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
fix crash of sharedata by incref before sharedated.monitor return cobj to client.
crash occr analise: 1.sharedated.update call many times in a short time(eg:3 times) to change a same name conf value to a->b->c->d. 2.sharedated sending 3 response to monitoring clients。a->b and b->c and c->d. 3.if b is destroyed and it's memory is reallocated and rewrited when client process the first message a->b, client's call lbox will crash. solution: conf b must be keeped before message(a->b) is processed by inc it's ref. Any return value from host to client must use incref before send to client.
This commit is contained in:
@@ -18,6 +18,7 @@ local function monitor(name, obj, cobj)
|
||||
break
|
||||
end
|
||||
sd.update(obj, newobj)
|
||||
skynet.send(service, "lua", "confirm" , newobj)
|
||||
end
|
||||
if cache[name] == obj then
|
||||
cache[name] = nil
|
||||
|
||||
Reference in New Issue
Block a user