zulip / python-zulip-api

Python library for the Zulip API.
https://zulip.com/api/
Apache License 2.0
350 stars 352 forks source link

IRC bridge: Reading IRC messages times out #772

Open albbas opened 1 year ago

albbas commented 1 year ago

Using this command:

python irc-mirror.py \
--irc-server=irc.oftc.net \
--channel="#apertium" \
--nick-prefix=IRC_mirror \
--stream=IRCmirrors \
--topic=Apertium \
--insecure \
--site=xxx \
--user=xxx \
--api-key=xxx

the irc bridge fails to read messages from the irc with the following exception:

Exception in callback _SelectorSocketTransport._call_connection_lost(ReadTimeout(R...meout=15.0)")))
handle: <Handle _SelectorSocketTransport._call_connection_lost(ReadTimeout(R...meout=15.0)")))>
Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 976, in _call_connection_lost
    super()._call_connection_lost(exc)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 734, in _call_connection_lost
    self._protocol.connection_lost(exc)
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client_aio.py", line 82, in connection_lost
    self.connection.disconnect()
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client_aio.py", line 214, in disconnect
    self._handle_event(Event("disconnect", self.server, "", [message]))
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client.py", line 389, in _handle_event
    self.reactor._handle_event(self, event)
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client.py", line 933, in _handle_event
    result = handler.callback(connection, event)
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/bot.py", line 208, in _on_disconnect
    self.recon.run(self)
  File "/home/boerre/repos/githubs/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/bot.py", line 108, in run
    self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'

Sending messages from Zulip to irc works.

Tested on Fedora 36 with python 3.8, 3.9 and 3.10, Ubuntu 22.04 with python3.10 and Centos with python3.6

asdf8dfafjk commented 1 year ago

Same

hallyn commented 8 months ago

Ditto on ubuntu focal.

rht commented 5 months ago

I reverted using the AioReactor in #793, and so the problem should no longer be there. Also, it has the SASL support for Libera.Chat.