Twisted reactor.listenUNIX erroring after update to python 3.8

92 views Asked by At

I have updated twisted from 13.0.0 to 20.3.0 and python from 2.7 to 3.8 and now twisted is throwing this not helpful error. (Ubuntu 16.04.6 LTS)

I verified the permissions of the .sock file and the directory, made sure the socket file is deleted before reactor.listenUNIX is called.

What could be the cause of this and how can I troubleshoot this issue?

class UserServer(Plugin):
    def setup(self):
        socket = self.parent.socket
        if os.path.exists(socket):
            os.remove(socket)
        self.console(socket)
        self.console(self.parent.config.get_umask('sock'))
        self.factory = UserServerFactory(self.parent)
        reactor.listenUNIX(socket, self.factory, mode=self.parent.config.get_umask('sock'))
service: 'user_server' failed to initialize
Traceback (most recent call last):
  File "/home/mcgen/tools/mark2/mk2/plugins/__init__.py", line 335, in load
    plugin = cls(self.parent, name, **kwargs)
  File "/home/mcgen/tools/mark2/mk2/plugins/__init__.py", line 165, in __init__
    self.setup()
  File "/home/mcgen/tools/mark2/mk2/services/user_server.py", line 148, in setup
    reactor.listenUNIX(socket, self.factory, mode=self.parent.config.get_umask('sock'))
  File "/usr/local/lib/python3.8/dist-packages/twisted/internet/posixbase.py", line 397, in listenUNIX
    p.startListening()
  File "/usr/local/lib/python3.8/dist-packages/twisted/internet/unix.py", line 408, in startListening
    self.startReading()
  File "/usr/local/lib/python3.8/dist-packages/twisted/internet/abstract.py", line 435, in startReading
    self.reactor.addReader(self)
  File "/usr/local/lib/python3.8/dist-packages/twisted/internet/epollreactor.py", line 109, in addReader
    self._add(reader, self._reads, self._writes, self._selectables,
  File "/usr/local/lib/python3.8/dist-packages/twisted/internet/epollreactor.py", line 96, in _add
    self._poller.register(fd, flags)
OSError: [Errno 22] Invalid argument
0

There are 0 answers