Skip to content

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

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

Closed
viciious opened this issue Aug 31, 2016 · 4 comments
Closed

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

viciious opened this issue Aug 31, 2016 · 4 comments

Comments

@viciious
Copy link

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

@viciious
Copy link
Author

$ tarantool --version
Tarantool 1.6.8-525-ga571ac0
Target: Darwin-x86_64-Release
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/tarantool/1.6.8-525 -DENABLE_TRACE=ON -DENABLE_BACKTRACE=OFF
Compiler: /usr/local/Library/ENV/4.3/clang /usr/local/Library/ENV/4.3/clang++
C_FLAGS: -fexceptions -funwind-tables -fno-common -fopenmp -msse2 -std=c11 -Wall -Wextra -Wno-strict-aliasing
CXX_FLAGS: -fexceptions -funwind-tables -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing

@mejedi
Copy link
Contributor

mejedi commented Aug 31, 2016

Please pass reconnect_after=<timeout> to net_box.new.

We will improve the documentation (tarantool/doc#33)

@mejedi mejedi closed this as completed Aug 31, 2016
@viciious
Copy link
Author

viciious commented Sep 1, 2016

Is the new option only available on the development branch?

@mejedi
Copy link
Contributor

mejedi commented Sep 6, 2016

@viciious
Available in 1.6 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants