Invalid use of loopback 127.7.x.x
commit: ebaa9ca2 test: dynamic discovery test
It looks like there are 2 problems:
test/int/conftest.py:91: TypeError: 'NoneType' object cannot be interpreted as an integer
-
tx_binary: failed to bind on 127.7.0.1:3301: bind, called on fd 18, aka 0.0.0.0:0
. This one I think is related to MacOS. 127.7.x.x doesn't seem to work.
pipenv run pytest -k call_normal
==================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.10.3, pytest-7.1.2, pluggy-1.0.0 -- /Users/s/.virtualenvs/picodata-hiEGUDBy/bin/python
cachedir: .pytest_cache
rootdir: /Users/s/work/picodata, configfile: pytest.ini
plugins: xdist-2.5.0, forked-1.4.0, clarity-1.0.1
collected 12 items / 11 deselected / 1 selected
test/int/test_basics.py::test_call_normalization ERROR [100%]
=========================================================================================== ERRORS ===========================================================================================
_________________________________________________________________________ ERROR at setup of test_call_normalization __________________________________________________________________________
self = <tarantool.connection.Connection object at 0x1066eee30>
def connect_tcp(self):
'''
Create connection to the host and port specified in __init__().
:raise: `NetworkError`
'''
try:
# If old socket already exists - close it and re-create
self.connected = True
if self._socket:
self._socket.close()
> self._socket = socket.create_connection(
(self.host, self.port), timeout=self.connection_timeout)
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:274:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
address = ('127.7.0.1', 3301), timeout = 1, source_address = None
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
A host of '' or port 0 tells the OS to use the default.
"""
host, port = address
err = None
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket(af, socktype, proto)
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
if source_address:
sock.bind(source_address)
sock.connect(sa)
# Break explicitly a reference cycle
err = None
return sock
except error as _:
err = _
if sock is not None:
sock.close()
if err is not None:
try:
> raise err
../../.pyenv/versions/3.10.3/lib/python3.10/socket.py:845:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
address = ('127.7.0.1', 3301), timeout = 1, source_address = None
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
A host of '' or port 0 tells the OS to use the default.
"""
host, port = address
err = None
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket(af, socktype, proto)
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
if source_address:
sock.bind(source_address)
> sock.connect(sa)
E TimeoutError: timed out
../../.pyenv/versions/3.10.3/lib/python3.10/socket.py:833: TimeoutError
During handling of the above exception, another exception occurred:
self = <tarantool.connection.Connection object at 0x1066eee30>
def connect(self):
'''
Create connection to the host and port specified in __init__().
Usually there is no need to call this method directly,
since it is called when you create an `Connection` instance.
:raise: `NetworkError`
'''
try:
> self.connect_basic()
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tarantool.connection.Connection object at 0x1066eee30>
def connect_basic(self):
if self.host == None:
self.connect_unix()
else:
> self.connect_tcp()
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:261:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tarantool.connection.Connection object at 0x1066eee30>
def connect_tcp(self):
'''
Create connection to the host and port specified in __init__().
:raise: `NetworkError`
'''
try:
# If old socket already exists - close it and re-create
self.connected = True
if self._socket:
self._socket.close()
self._socket = socket.create_connection(
(self.host, self.port), timeout=self.connection_timeout)
self._socket.settimeout(self.socket_timeout)
self._socket.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
except socket.error as e:
self.connected = False
> raise NetworkError(e)
E tarantool.error.NetworkError: (0, 'Socket timeout')
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:280: NetworkError
During handling of the above exception, another exception occurred:
args = (Instance(i1, listen=127.7.0.1:3301), 'picolib.raft_status'), kwargs = {}
def inner(*args, **kwargs):
try:
> result = func(*args, **kwargs)
test/int/conftest.py:85:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Instance(i1, listen=127.7.0.1:3301), fn = 'picolib.raft_status', timeout = 1, args = ()
@normalize_net_box_result
def call(self, fn, *args, timeout: int = 1):
> with self.connection(timeout) as conn:
test/int/conftest.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <contextlib._GeneratorContextManager object at 0x10624c730>
def __enter__(self):
# do not keep args and kwds alive unnecessarily
# they are only needed for recreation, which is not possible anymore
del self.args, self.kwds, self.func
try:
> return next(self.gen)
../../.pyenv/versions/3.10.3/lib/python3.10/contextlib.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Instance(i1, listen=127.7.0.1:3301), timeout = 1
@contextmanager
def connection(self, timeout: int):
> c = Connection(
self.host,
self.port,
socket_timeout=timeout,
connection_timeout=timeout,
)
test/int/conftest.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tarantool.connection.Connection object at 0x1066eee30>, host = '127.7.0.1', port = 3301, user = None, password = None, socket_timeout = 1, reconnect_max_attempts = 10
reconnect_delay = 0.1, connect_now = True, encoding = 'utf-8', use_list = True, call_16 = False, connection_timeout = 1
def __init__(self, host, port,
user=None,
password=None,
socket_timeout=SOCKET_TIMEOUT,
reconnect_max_attempts=RECONNECT_MAX_ATTEMPTS,
reconnect_delay=RECONNECT_DELAY,
connect_now=True,
encoding=ENCODING_DEFAULT,
use_list=True,
call_16=False,
connection_timeout=CONNECTION_TIMEOUT):
'''
Initialize a connection to the server.
:param str host: Server hostname or IP-address
:param int port: Server port
:param bool connect_now: if True (default) than __init__() actually
creates network connection.
if False than you have to call connect() manualy.
'''
if msgpack.version >= (1, 0, 0) and encoding not in (None, 'utf-8'):
raise ConfigurationError("Only None and 'utf-8' encoding option " +
"values are supported with msgpack>=1.0.0")
if os.name == 'nt':
libc = ctypes.WinDLL(
ctypes.util.find_library('Ws2_32'), use_last_error=True
)
else:
libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
recv = self._sys_recv = libc.recv
recv.argtypes = [
ctypes.c_int, ctypes.c_void_p, c_ssize_t, ctypes.c_int]
recv.restype = ctypes.c_int
self.host = host
self.port = port
self.user = user
self.password = password
self.socket_timeout = socket_timeout
self.reconnect_delay = reconnect_delay
self.reconnect_max_attempts = reconnect_max_attempts
self.schema = Schema(self)
self.schema_version = 1
self._socket = None
self.connected = False
self.error = True
self.encoding = encoding
self.use_list = use_list
self.call_16 = call_16
self.connection_timeout = connection_timeout
if connect_now:
> self.connect()
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tarantool.connection.Connection object at 0x1066eee30>
def connect(self):
'''
Create connection to the host and port specified in __init__().
Usually there is no need to call this method directly,
since it is called when you create an `Connection` instance.
:raise: `NetworkError`
'''
try:
self.connect_basic()
self.handshake()
self.load_schema()
except Exception as e:
self.connected = False
> raise NetworkError(e)
E tarantool.error.NetworkError: (0, 'Socket timeout')
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/tarantool/connection.py:326: NetworkError
During handling of the above exception, another exception occurred:
cluster = Cluster("127.7.0.1", n=1)
@pytest.fixture
def instance(cluster: Cluster) -> Generator[Instance, None, None]:
> cluster.deploy(instance_count=1)
test/int/conftest.py:397:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/int/conftest.py:326: in deploy
instance.wait_ready()
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/funcy/decorators.py:45: in wrapper
return deco(call, *dargs, **dkwargs)
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/funcy/flow.py:127: in retry
return call()
../../.virtualenvs/picodata-hiEGUDBy/lib/python3.10/site-packages/funcy/decorators.py:66: in __call__
return self._func(*self._args, **self._kwargs)
test/int/conftest.py:283: in wait_ready
status = self.__raft_status()
test/int/conftest.py:263: in __raft_status
status = self.call("picolib.raft_status")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (Instance(i1, listen=127.7.0.1:3301), 'picolib.raft_status'), kwargs = {}
def inner(*args, **kwargs):
try:
result = func(*args, **kwargs)
except DatabaseError as exc:
if hasattr(exc, "errno"):
# Error handling in Tarantool connector is awful.
# It wraps NetworkError in DatabaseError.
# We, instead, convert it to a native OSError.
> strerror = os.strerror(exc.errno)
E TypeError: 'NoneType' object cannot be interpreted as an integer
test/int/conftest.py:91: TypeError
----------------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------------------
[supervisor:80706] running StartDiscover
[supervisor:80706] subprocess finished: Ok(Signaled(Pid(80707), SIGABRT, false))
----------------------------------------------------------------------------------- Captured stderr setup ------------------------------------------------------------------------------------
warning: 'tarantool-sys/patches-applied' exists, so patching step is skipped
Finished dev [unoptimized + debuginfo] target(s) in 0.14s
>>>>> start_discover()
2022-05-17 10:00:44.225 [80707] main/103/interactive C> Tarantool 2.8.3-0-g01023dbc2
2022-05-17 10:00:44.226 [80707] main/103/interactive C> log level 5
2022-05-17 10:00:44.226 [80707] main/103/interactive I> wal/engine cleanup is paused
2022-05-17 10:00:44.226 [80707] main/103/interactive I> mapping 268435456 bytes for memtx tuple arena...
2022-05-17 10:00:44.226 [80707] main/103/interactive I> Actual slab_alloc_factor calculated on the basis of desired slab_alloc_factor = 1.044274
2022-05-17 10:00:44.226 [80707] main/103/interactive I> mapping 134217728 bytes for vinyl tuple arena...
2022-05-17 10:00:44.232 [80707] main/103/interactive I> instance uuid e254b53b-6b6e-4202-aa98-7c9b5b4252dc
2022-05-17 10:00:44.232 [80707] main/103/interactive I> tx_binary: stopped
2022-05-17 10:00:44.233 [80707] main/103/interactive I> initializing an empty data directory
2022-05-17 10:00:44.262 [80707] main/103/interactive I> assigned id 1 to replica e254b53b-6b6e-4202-aa98-7c9b5b4252dc
2022-05-17 10:00:44.263 [80707] main/103/interactive I> cluster uuid db161481-326c-4c6b-a946-fd42626cadf3
2022-05-17 10:00:44.265 [80707] snapshot/101/main I> saving snapshot `/private/var/folders/w8/hjmgsmvn55z2m19l8pvxkc940000gn/T/pytest-of-s/pytest-28/test_call_normalization0/i1/00000000000000000000.snap.inprogress'
2022-05-17 10:00:44.266 [80707] snapshot/101/main I> done
2022-05-17 10:00:44.266 [80707] main/103/interactive I> ready to accept requests
2022-05-17 10:00:44.266 [80707] main/105/gc I> wal/engine cleanup is resumed
2022-05-17 10:00:44.266 [80707] main/103/interactive I> set 'log_level' configuration option to 5
2022-05-17 10:00:44.267 [80707] main/103/interactive I> set 'feedback_enabled' configuration option to false
2022-05-17 10:00:44.267 [80707] main/103/interactive I> set 'replication' configuration option to []
2022-05-17 10:00:44.267 [80707] main/103/interactive I> set 'log_format' configuration option to "plain"
2022-05-17 10:00:44.267 [80707] main/106/checkpoint_daemon I> scheduled next checkpoint for Tue May 17 11:34:59 2022
2022-05-17 10:00:44.271 [80707] main/103/interactive I> tx_binary: stopped
2022-05-17 10:00:44.271 [80707] main/103/interactive evio.c:396 E> tx_binary: failed to bind on 127.7.0.1:3301: bind, called on fd 18, aka 0.0.0.0:0
2022-05-17 10:00:44.271 [80707] main/103/interactive I> tx_binary: stopped
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LuaError(ExecutionError("tx_binary: failed to bind, called on fd -1"))', src/tarantool.rs:145:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
================================================================================== short test summary info ===================================================================================
ERROR test/int/test_basics.py::test_call_normalization - TypeError: 'NoneType' object cannot be interpreted as an integer
============================================================================== 11 deselected, 1 error in 25.77s ==============================================================================