NASA-AMMOS / AIT-Core

MIT License
44 stars 27 forks source link

builtins.OSError: [Errno 97] Address family not supported by protocol when ipv6 disabled at kernel level #399

Closed Mejiro-McQueen closed 2 years ago

Mejiro-McQueen commented 2 years ago

When IPV6 is disabled at the kernel level, the following error appears during runtime. builtins.OSError: [Errno 97] Address family not supported by protocol

AMMOS Kickstarts and AMIs have disabled IPV6 at the kernel level. I strongly recommend against this, but alas, here's a fix.

Mejiro-McQueen commented 2 years ago

For reference:

(AIT-Core) avazquez@AIT-Sunrise:~/bin/AIT-Deploy$ make clean nofork
2022-01-11T01:59:41.102 | WARNING  | Config parameter command.history.filename specifies nonexistent path /home/avazquez/bin/AIT-Deploy/cmdhist.pcap
2022-01-11T01:59:41.103 | WARNING  | Config parameter dsn.cfdp.mib.path specifies nonexistent path /home/avazquez/bin/AIT-Deploy/AIT-Core/config/mib
2022-01-11T01:59:41.103 | WARNING  | Config parameter dsn.cfdp.datasink.outgoing.path specifies nonexistent path /home/avazquez/bin/AIT-Deploy/AIT-Core/ait/dsn/cfdp/datasink/outgoing
2022-01-11T01:59:41.103 | WARNING  | Config parameter dsn.cfdp.datasink.incoming.path specifies nonexistent path /home/avazquez/bin/AIT-Deploy/AIT-Core/ait/dsn/cfdp/datasink/incoming
2022-01-11T01:59:41.103 | WARNING  | Config parameter dsn.cfdp.datasink.tempfiles.path specifies nonexistent path /home/avazquez/bin/AIT-Deploy/AIT-Core/ait/dsn/cfdp/datasink/tempfiles
2022-01-11T01:59:41.103 | WARNING  | Config parameter dsn.cfdp.datasink.pdusink.path specifies nonexistent path /home/avazquez/bin/AIT-Deploy/AIT-Core/ait/dsn/cfdp/datasink/pdusink
2022-01-11T01:59:41.103 | WARNING  | Config parameter data.1553.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/downlink/1553
2022-01-11T01:59:41.103 | WARNING  | Config parameter data.bad.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/downlink/bad
2022-01-11T01:59:41.103 | WARNING  | Config parameter data.lehx.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/downlink/lehx
2022-01-11T01:59:41.103 | WARNING  | Config parameter data.planning.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/planning
2022-01-11T01:59:41.103 | WARNING  | Config parameter data.sdos.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/sdos
2022-01-11T01:59:41.104 | WARNING  | Config parameter data.uplink.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/uplink
2022-01-11T01:59:41.104 | WARNING  | Config parameter data.ats.path specifies nonexistent path /gds/dev/data/AIT-Sunrise/2022/2022-011/ats
2022-01-11T01:59:41.229 | WARNING  | No handlers specified for stream log_stream
2022-01-11T01:59:41.230 | INFO     | Added inbound stream <PortInputStream address=:2514>
2022-01-11T01:59:41.288 | INFO     | Attempting to load leapseconds.dat
2022-01-11T01:59:41.295 | INFO     | Loaded leapseconds config file successfully
2022-01-11T01:59:41.295 | INFO     | Attempting to acquire latest leapsecond data
2022-01-11T01:59:41.778 | INFO     | Leapsecond data processed
2022-01-11T01:59:41.778 | INFO     | Successfully generated leapseconds config file
2022-01-11T01:59:41.780 | INFO     | Created handler PacketHandler for stream telem_stream
2022-01-11T01:59:41.780 | INFO     | Added inbound stream <PortInputStream address=:3076>
2022-01-11T01:59:41.780 | WARNING  | No handlers specified for stream command_stream
2022-01-11T01:59:41.780 | INFO     | Added outbound stream <PortOutputStream name=command_stream>
2022-01-11T01:59:41.781 | WARNING  | No configuration found for API Streams. Attempting to determine valid streams to use as default.
2022-01-11T01:59:41.781 | INFO     | Located potentially valid streams. ['telem_stream'] uses a compatible handler (['PacketHandler', 'CCSDSPacketHandler']).
2022-01-11T01:59:41.781 | WARNING  | No handlers specified for stream __tlmpkts__
2022-01-11T01:59:41.781 | WARNING  | No valid plugin configurations found. No plugins will be added.
2022-01-11T01:59:41.781 | INFO     | Starting <Broker at 0x7f87a0a13ef0: _run> greenlet...
2022-01-11T01:59:41.781 | INFO     | Starting <ZMQStream name=__tlmpkts__> greenlet...
2022-01-11T01:59:41.781 | INFO     | Starting <PortOutputStream name=command_stream> greenlet...
2022-01-11T01:59:41.781 | INFO     | Starting <PortInputStream address=:2514> greenlet...
Traceback with variables (most recent call last):
  File "/home/avazquez/miniconda3/envs/AIT-Core/bin/ait-server", line 8, in <module>
    sys.exit(main())
      __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f87a54a7ad0>
      __builtins__ = {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <class '_frozen_importlib.BuiltinImporter'>, '__spec__': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), '__build_class__': <built-in function __build_class__>, '__import__': <built-in function __import__>, 'abs': <built-in function abs>, 'all': <built-in function all>, 'any': <built-in function any>, 'ascii': <built-in function ascii>, 'bin': <built-in function bin>, 'breakpoint': <built-in function breakpoint>, 'callable': <built-in function callable>, 'chr': <built-in function chr>, 'compile': <built-in function compile>, 'delattr': <built-in function delattr>, 'dir': <built-in function dir>, 'divmod': <built-in function divmod>, 'eval': <built-in function eval>, 'exec': <built-in function exec>, 'format': <built-in function format>, 'getattr': <built-i...
      __package__ = None
      __spec__ = None
      __cached__ = None
      __name__ = '__main__'
      __file__ = '/home/avazquez/miniconda3/envs/AIT-Core/bin/ait-server'
      re = <module 're' from '/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/re.py'>
      sys = <module 'sys' (built-in)>
      main = <function main at 0x7f87a52cc560>
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/ait/core/bin/ait_server.py", line 22, in main
    tlm_cmd_serv.wait()
      ap = ArgumentParser(prog='ait-server', usage=None, description='\nUsage: ait-server\n\nStart the AIT telemetry server for managing telemety streams,\ncommand outputs, processing handlers, and plugins.\n', formatter_class=<class 'argparse.ArgumentDefaultsHelpFormatter'>, conflict_handler='error', add_help=True)
      args = Namespace()
      tlm_cmd_serv = <ait.core.server.server.Server object at 0x7f87a0346a50>
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/ait/core/server/server.py", line 52, in wait
    greenlet.start()
      self = <ait.core.server.server.Server object at 0x7f87a0346a50>
      greenlet = <PortInputStream name=log_stream>
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/gevent/baseserver.py", line 305, in start
    self.init_socket()
      self = <PortInputStream name=log_stream>
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/gevent/server.py", line 221, in init_socket
    self.socket = self.get_listener(self.address, self.family)
      self = <PortInputStream name=log_stream>
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/gevent/server.py", line 231, in get_listener
    return _udp_socket(address, reuse_addr=cls.reuse_addr, family=family)
      cls = <class 'ait.core.server.stream.PortInputStream'>
      address = ('', 2514)
      family = 10
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/gevent/server.py", line 272, in _udp_socket
    sock = GeventSocket(family=family, type=SOCK_DGRAM)
      address = ('', 2514)
      backlog = 50
      reuse_addr = 1
      family = 10
  File "/home/avazquez/miniconda3/envs/AIT-Core/lib/python3.7/site-packages/gevent/_socket3.py", line 114, in __init__
    self._sock = self._gevent_sock_class(family, type, proto, fileno)
      self = <socket [RecursionError('maximum recursion depth exceeded')]>
      family = 10
      type = 2
      proto = 0
      fileno = None
builtins.OSError: [Errno 97] Address family not supported by protocol
Makefile:39: recipe for target 'nofork' failed
make: *** [nofork] Error 1
Mejiro-McQueen commented 2 years ago

I think gevent first tries IPV6 when no IP is provided. Since the kernel module isn't there, disaster strikes.

If the module was there, it would probably fall back to IPv4 In either case, you can explicitly add localhost to the port, and gevent will be happy.