-
Notifications
You must be signed in to change notification settings - Fork 388
Closed
Labels
Description
Tarantool version:
Tarantool 2.4.2
Tarantool 2.5.1-84-gec2976dc6
OS version:
macos
Bug description:
Start server, start client.
Client with netbox connnects to server and at netbox.on_connect
makes some remote admin actions on server with remote :call
.
And client starts to use 100% cpu.
Steps to reproduce:
1st terminal
$ tarantool server.lua
2nd terminal
$ tarantool client.lua
server.lua
local uri = require('uri')
local conf = {
--- Replication user/password
user = 'rep',
password = 'pwd',
}
function add_player(server)
if box.session.peer() == nil then
return false
end
local server = uri.parse(server)
local replica = uri.parse(box.session.peer())
replica.service = server.service
replica.login = conf.user
replica.password = conf.password
replica = uri.format(replica, {include_password=true})
local replication = box.cfg.replication or {}
local found = false
for _, it in ipairs(replication) do
if it == replica then
found = true
break
end
end
if not found then
table.insert(replication, replica)
box.cfg({replication=replication})
end
return true
end
local fio = require('fio')
fio.mktree("./srv")
box.cfg{
listen="0.0.0.0:3301",
replication_connect_quorum=0,
replication_connect_timeout=0.1,
work_dir="./srv",
}
box.schema.user.create(conf.user, { password = conf.password, if_not_exists=true })
box.schema.user.grant(conf.user, 'replication', nil, nil, { if_not_exists=true })
box.schema.user.grant('guest', 'read,write,execute', 'universe', nil, { if_not_exists=true })
box.schema.func.create('add_player', { if_not_exists=true} )
box.schema.user.grant(conf.user, 'execute', 'function', 'add_player', { if_not_exists=true })
require('console').start()
os.exit(1)
client.lua
local netbox = require('net.box')
local conf = {
--- Replication user/password
user = 'rep',
password = 'pwd',
}
local fio = require('fio')
fio.mktree("./clnt")
box.cfg{listen="0.0.0.0:3302",
replication={ "0.0.0.0:3301" },
replication_connect_timeout=60,
replication_connect_quorum=1,
work_dir="./clnt",}
_G.conn = netbox.connect(conf.user..":" .. conf.password .."@".."127.0.0.1:3301",
{wait_connected=false,
reconnect_after=2})
conn:on_connect(function(client)
local rc, res = pcall(client.call, client, 'add_player', {localserver})
if not rc then
log.info(res)
end
end)
require('console').start()
os.exit(1)
Workaround is to use fiber at client
local netbox = require('net.box')
local conf = {
--- Replication user/password
user = 'rep',
password = 'pwd',
}
local fio = require('fio')
fio.mktree("./clnt")
box.cfg{listen="0.0.0.0:3302",
replication={ "0.0.0.0:3301" },
replication_connect_timeout=60,
replication_connect_quorum=1,
work_dir="./clnt",}
_G.conn = netbox.connect(conf.user..":" .. conf.password .."@".."127.0.0.1:3301",
{wait_connected=false,
reconnect_after=2})
conn:on_connect(function(client)
fiber.new(function()
local rc, res = pcall(client.call, client, 'add_player', {localserver})
if not rc then
log.info(res)
end
end)
end)
require('console').start()
os.exit(1)