Skip to content

net.box connection not re-established after a disconnect #1733

Closed
@viciious

Description

@viciious

t1.lua

box.cfg{listen=12123}

function hello() print('hello') end

box.schema.func.create('hello', {if_not_exists = true})
box.schema.user.grant('guest', 'execute', 'function', 'hello', {if_not_exists = true})

t2.lua

local net_box = require('net.box')
local fiber = require('fiber')

box.cfg{}

cf = fiber.create(function()
    local conn = net_box.new('127.0.0.1:12123')
    while true do
        conn:timeout(10):call('hello')
        fiber.sleep(1)
    end
end)

mon = fiber.create(function()
    while true do
        print(cf:status())
        fiber.sleep(1)
    end
end)

Steps to reproduce:

  • start the first tarantool instance: tarantool t1.lua
  • start the second tarantool instance: tarantool t2.lua
  • watch the first and the second instances print "hello" and "suspended" at 1s intervals respectively
  • restart the first instance
  • see the 'cf' fiber die in the second instance:

2016-08-31 19:40:39.437 [86256] main/106/net.box.read net_box.lua:503 W> 127.0.0.1:12123: Remote host closed connection
suspended
2016-08-31 19:40:39.861 [86256] main/104/lua net_box.lua:915 E> ER_NO_CONNECTION: Connection is not established
dead

The observed behavior doesn't match the documentation on net.box.new():

net_box.new(URI[, {option[s]}])
Create a new connection. The connection is established on demand, at the time of the first request. It is re-established automatically after a disconnect.

https://tarantool.org/doc/reference_lua/net_box.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions