tests/system/tcp/tests-tcp.py timeout consistently
Summary
tests-tcp.py consistently failing on Solaris 11.4 as call to socket.create_connection(..., timeout=1)
times out.
BIND version used
9.18.4
Steps to reproduce
cd tests/system; ./run.sh tcp
What is the current bug behavior?
Test consistently fails, occasional one passes.
What is the expected correct behavior?
Test passes consistently, it just needs a little more time.
Relevant configuration files
Not applicable.
Relevant logs and/or screenshots
I:tcp:starting servers
D:tcp:============================= test session starts ==============================
D:tcp:platform sunos5 -- Python 3.7.12, pytest-7.0.0, pluggy-1.0.0 -- /usr/bin/python3.7
D:tcp:cachedir: .pytest_cache
D:tcp:hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/builds/bind-9.18/components/bind/build/sparcv9/bin/tests/system/tcp/.hypothesis/examples')
D:tcp:rootdir: /builds/bind-9.18/components/bind/build/sparcv9/bin/tests/system/tcp
D:tcp:plugins: hypothesis-4.57.1
D:tcp:collecting ... collected 3 items
D:tcp:
D:tcp:tests-tcp.py::test_tcp_garbage FAILED [ 33%]
D:tcp:tests-tcp.py::test_tcp_garbage_response FAILED [ 66%]
D:tcp:tests-tcp.py::test_close_wait FAILED [100%]
D:tcp:
D:tcp:=================================== FAILURES ===================================
D:tcp:_______________________________ test_tcp_garbage _______________________________
D:tcp:
D:tcp:named_port = 5300
D:tcp:
D:tcp: def test_tcp_garbage(named_port):
D:tcp: with create_socket("10.53.0.7", named_port) as sock:
D:tcp:
D:tcp: msg = create_msg("a.example.", "A")
D:tcp: (sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
D:tcp:> (response, rtime) = dns.query.receive_tcp(sock, timeout())
D:tcp:
D:tcp:tests-tcp.py:50:
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:717: in receive_tcp
D:tcp: ldata = _net_read(sock, 2, expiration)
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:
D:tcp:sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
D:tcp:count = 2, expiration = 1655993050.969228
D:tcp:
D:tcp: def _net_read(sock, count, expiration):
D:tcp: """Read the specified number of bytes from sock. Keep trying until we
D:tcp: either get the desired amount, or we hit EOF.
D:tcp: A Timeout exception will be raised if the operation is not completed
D:tcp: by the expiration time.
D:tcp: """
D:tcp: s = b''
D:tcp: while count > 0:
D:tcp: try:
D:tcp:> n = sock.recv(count)
D:tcp:E socket.timeout: timed out
D:tcp:
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:637: timeout
D:tcp:__________________________ test_tcp_garbage_response ___________________________
D:tcp:
D:tcp:named_port = 5300
D:tcp:
D:tcp: def test_tcp_garbage_response(named_port):
D:tcp: with create_socket("10.53.0.7", named_port) as sock:
D:tcp:
D:tcp: msg = create_msg("a.example.", "A")
D:tcp: (sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
D:tcp:> (response, rtime) = dns.query.receive_tcp(sock, timeout())
D:tcp:
D:tcp:tests-tcp.py:73:
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:717: in receive_tcp
D:tcp: ldata = _net_read(sock, 2, expiration)
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:
D:tcp:sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
D:tcp:count = 2, expiration = 1655993052.2569585
D:tcp:
D:tcp: def _net_read(sock, count, expiration):
D:tcp: """Read the specified number of bytes from sock. Keep trying until we
D:tcp: either get the desired amount, or we hit EOF.
D:tcp: A Timeout exception will be raised if the operation is not completed
D:tcp: by the expiration time.
D:tcp: """
D:tcp: s = b''
D:tcp: while count > 0:
D:tcp: try:
D:tcp:> n = sock.recv(count)
D:tcp:E socket.timeout: timed out
D:tcp:
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:637: timeout
D:tcp:_______________________________ test_close_wait ________________________________
D:tcp:
D:tcp:named_port = 5300
D:tcp:
D:tcp: def test_close_wait(named_port):
D:tcp: with create_socket("10.53.0.7", named_port) as sock:
D:tcp:
D:tcp: msg = create_msg("a.example.", "A")
D:tcp: (sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
D:tcp:> (response, rtime) = dns.query.receive_tcp(sock, timeout())
D:tcp:
D:tcp:tests-tcp.py:97:
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:717: in receive_tcp
D:tcp: ldata = _net_read(sock, 2, expiration)
D:tcp:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:tcp:
D:tcp:sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
D:tcp:count = 2, expiration = 1655993053.3719778
D:tcp:
D:tcp: def _net_read(sock, count, expiration):
D:tcp: """Read the specified number of bytes from sock. Keep trying until we
D:tcp: either get the desired amount, or we hit EOF.
D:tcp: A Timeout exception will be raised if the operation is not completed
D:tcp: by the expiration time.
D:tcp: """
D:tcp: s = b''
D:tcp: while count > 0:
D:tcp: try:
D:tcp:> n = sock.recv(count)
D:tcp:E socket.timeout: timed out
D:tcp:
D:tcp:/home/smarshal/.local/lib/python3.7/site-packages/dns/query.py:637: timeout
D:tcp:=========================== short test summary info ============================
D:tcp:FAILED tests-tcp.py::test_tcp_garbage - socket.timeout: timed out
D:tcp:FAILED tests-tcp.py::test_tcp_garbage_response - socket.timeout: timed out
D:tcp:FAILED tests-tcp.py::test_close_wait - socket.timeout: timed out
D:tcp:============================== 3 failed in 3.98s ===============================
I:tcp:FAILED
I:tcp:stopping servers
R:tcp:FAIL
E:tcp:2022-06-23T07:04:06-0700
FAIL: tcp
Possible fixes
Increase timeout in call to socket.create_connection in tests-tcp.py
In my testing I modified it from timeout=1
to timeout=10
.