Gitlab CI configuration does not allow validation/server.py to bind on an IPv6
Description
As of today, the CI fails systematically on the test-unit
job, with the following error when opening freeopcua server:
Configuring FreeOpcUa test server
Traceback (most recent call last):
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1044, in create_server
sock.bind(sa)
OSError: [Errno 99] Cannot assign requested address
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builds/systerel/S2OPC/validation/server.py", line 67, in <module>
server.start()
File "/usr/local/lib/python3.6/site-packages/opcua-0.90.3-py3.6.egg/opcua/server/server.py", line 281, in start
File "/usr/local/lib/python3.6/site-packages/opcua-0.90.3-py3.6.egg/opcua/server/server.py", line 278, in start
File "/usr/local/lib/python3.6/site-packages/opcua-0.90.3-py3.6.egg/opcua/server/binary_server_asyncio.py", line 106, in start
File "/usr/local/lib/python3.6/site-packages/opcua-0.90.3-py3.6.egg/opcua/common/utils.py", line 193, in run_coro_and_wait
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1048, in create_server
% (sa, err.strerror.lower()))
OSError: [Errno 99] error while attempting to bind on address ('::1', 4841, 0, 0): cannot assign requested address
The problem has already been raised on some of the developers' development linux, but was solve with a better configuration of their docker daemon.
Analysis
freeopcua
uses asyncio
to open its server. The function is called without specifying a family, hence effectively choosing IPv6 when translating the server URI opc.tcp://localhost:4841
to opc.tcp://[::1]:4841
. It is not possible to configure freeopcua
to favor an IPv4 translation.