Skip to content
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

Intermittent test failure #63

Closed
jtpereyda opened this issue Apr 13, 2016 · 2 comments
Closed

Intermittent test failure #63

jtpereyda opened this issue Apr 13, 2016 · 2 comments

Comments

@jtpereyda
Copy link
Owner

Investigate. Occurred at least twice, intermittently, on Windows 10 machine. boofuzz v0.0.3.dev13

C:\Users\josh\code\boofuzz>python -m tox
GLOB sdist-make: C:\Users\josh\code\boofuzz\setup.py
py27 inst-nodeps: C:\Users\josh\code\boofuzz\.tox\dist\boofuzz-0.0.3.dev13.zip
py27 installed: backports.ssl-match-hostname==3.5.0.1,boofuzz==0.0.3.dev13,certifi==2016.2.28,check-manifest==0.31,colorama==0.3.7,enum34==1.1.2,Flask==0.10.1,funcsigs==1.0.0,future==0.15.2,glob2==0.4.1,impacket==0.9.14,itsdangerous==0.24,Jinja2==2.8,Mako==1.0.4,MarkupSafe==0.23,mock==2.0.0,ordereddict==1.1,parse==1.6.6,parse-type==0.3.4,pbr==1.9.0,py==1.4.31,pydot2==1.0.33,pyparsing==2.1.1,pyserial==3.0.1,pytest==2.9.1,pytest-bdd==2.16.1,six==1.10.0,tornado==4.0.2,Werkzeug==0.11.5
py27 runtests: PYTHONHASHSEED='449'
py27 runtests: commands[0] | python -m pytest
============================= test session starts =============================
platform win32 -- Python 2.7.11, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: C:\Users\josh\code\boofuzz, inifile:
plugins: bdd-2.16.1
collected 106 items

unit_tests\test_ez_outlet_reset.py ................
unit_tests\test_fuzz_logger.py .............
unit_tests\test_fuzz_logger_text.py .......................
unit_tests\test_helpers_ip_str_to_bytes.py ...................
unit_tests\test_helpers_udp_checksum.py ........
unit_tests\test_serial_connection_generic.py ...............
unit_tests\test_socket_connection.py .ssssss..F..

================================== FAILURES ===================================
____________________ TestSocketConnection.test_tcp_client _____________________

self = <unit_tests.test_socket_connection.TestSocketConnection testMethod=test_tcp_client>

    def test_tcp_client(self):
        """
            Given: A SocketConnection 'tcp' object and a TCP server.
            When: Calling SocketConnection.open(), .send(), .recv(), and .close()
            Then: send() returns RAW_L3_MAX_PAYLOAD.
             and: Sent and received data is as expected.
            """
        data_to_send = bytes('uuddlrlrba')

        # Given
        server = MiniTestServer()
        server.bind()

        t = threading.Thread(target=server.serve_once)
        t.daemon = True
        t.start()

        uut = SocketConnection(host=socket.gethostname(), port=server.active_port, proto='tcp')
        uut.logger = logging.getLogger("SulleyUTLogger")

        # When
        uut.open()
        send_result = uut.send(data=data_to_send)
>       received = uut.recv(10000)

unit_tests\test_socket_connection.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <boofuzz.socket_connection.SocketConnection object at 0x00000000187B6940>
max_bytes = 10000

    def recv(self, max_bytes):
        """
            Receive up to max_bytes data from the target.

            :param max_bytes: Maximum number of bytes to receive.
            :type max_bytes: int

            :return: Received data.
            """
        try:
            if self.proto in ['tcp', 'ssl']:
>               data = self._sock.recv(max_bytes)
E               error: [Errno 10054] An existing connection was forcibly closed by the remote host

boofuzz\socket_connection.py:136: error
---------------------------- Captured stderr call -----------------------------
Exception in thread Thread-1:
Traceback (most recent call last):
  File "c:\python27\Lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "c:\python27\Lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Users\josh\code\boofuzz\unit_tests\test_socket_connection.py", line 174, in serve_once
    self.received = client_socket.recv(10000)
error: [Errno 10035] A non-blocking socket operation could not be completed immediately

=============== 1 failed, 99 passed, 6 skipped in 2.07 seconds ================
ERROR: InvocationError: 'C:\\Users\\josh\\code\\boofuzz\\.tox\\py27\\Scripts\\python.EXE -m pytest'
___________________________________ summary ___________________________________
ERROR:   py27: commands failed
@jtpereyda
Copy link
Owner Author

This script will run tests repeatedly and can help uncover the error:

#!/bin/bash
while : 
do
    sudo py.test unit_tests/test_socket_connection.py
    if [ $? -ne 0 ]; then
        break
    fi  
done

@SR4ven
Copy link
Collaborator

SR4ven commented Feb 16, 2020

Haven't come across this error anywhere.
I don't think this is still relevant. Otherwise reopen.

@SR4ven SR4ven closed this as completed Feb 16, 2020
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