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

test: failure in rpc_getdescriptorinfo.py (OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) #25765

Open
fanquake opened this issue Aug 1, 2022 · 5 comments

Comments

@fanquake
Copy link
Member

fanquake commented Aug 1, 2022

https://cirrus-ci.com/task/5258208494223360:

238/246 - rpc_getdescriptorinfo.py failed, Duration: 1 s
stdout:
2022-08-01T13:12:51.831000Z TestFramework (INFO): Initializing test directory C:\Users\ContainerAdministrator\AppData\Local\Temp\test_runner_₿_🏃_20220801_121834\rpc_getdescriptorinfo_6
2022-08-01T13:12:52.490000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\test_framework\test_framework.py", line 133, in main
    self.run_test()
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\rpc_getdescriptorinfo.py", line 38, in run_test
    self.test_desc('pkh(02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5)', isrange=False, issolvable=True, hasprivatekeys=False)
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\rpc_getdescriptorinfo.py", line 23, in test_desc
    info = self.nodes[0].getdescriptorinfo(desc)
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\test_framework\coverage.py", line 49, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\test_framework\authproxy.py", line 142, in __call__
    response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
  File "C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\test\functional\test_framework\authproxy.py", line 107, in _request
    self.__conn.request(method, path, postdata, headers)
  File "C:\Python39\lib\http\client.py", line 1257, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Python39\lib\http\client.py", line 1303, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Python39\lib\http\client.py", line 1252, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Python39\lib\http\client.py", line 1012, in _send_output
    self.send(msg)
  File "C:\Python39\lib\http\client.py", line 952, in send
    self.connect()
  File "C:\Python39\lib\http\client.py", line 923, in connect
    self.sock = self._create_connection(
  File "C:\Python39\lib\socket.py", line 843, in create_connection
    raise err
  File "C:\Python39\lib\socket.py", line 831, in create_connection
    sock.connect(sa)
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
2022-08-01T13:12:52.568000Z TestFramework (INFO): Stopping nodes
@maflcko
Copy link
Member

maflcko commented Aug 1, 2022

OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted is unrelated to the this test being run. It happens on windows all the time.

@fanquake
Copy link
Member Author

fanquake commented Aug 1, 2022

Shouldn't it be getting worked around by this:

# Increase the dynamic port range to the maximum allowed value to mitigate "OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted".
?

@maflcko
Copy link
Member

maflcko commented Aug 1, 2022

I think that only lowers the probability, but it still happens

@fanquake
Copy link
Member Author

Shouldn't it be getting worked around by this:

@sipsorcery any chance you can weigh in here? Can we improve this workaround in some way?

@sipsorcery
Copy link
Member

@sipsorcery any chance you can weigh in here? Can we improve this workaround in some way?

I have dealt with socket address in use problems on Windows in the past (the SIP prefix in sipsorcery refers to the communications signalling protocol). The problem I had was TCP sockets not closing DESPITE correctly calling the socket close/shutdown methods and even closing the owning process. Windows seems to ang on to the socket entry in some internal table and prevent the same, or a new, process from being able to reuse it for varying amounts of time (I recall it being up to 2 minutes but am probably wrong).

The approach I used, and that is still used in my SIP library today is to set the SO_REUSEADDR on TCP sockets that rely on a well known port.

I haven't looked at the code for the test mentioned in this issue, and wouldn't know how to set socket options in Python, but if it's easy to do it may be worth setting that socket option. It could cause other problems, if multiple tests are actually attempting to use the same socket, but if that was the case it should result in the same error on other OS's as well.

@DrahtBot DrahtBot changed the title test: failure in rpc_getdescriptorinfo.py test: failure in rpc_getdescriptorinfo.py (OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants