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

IRC integration #777

Open
haansn08 opened this issue Mar 1, 2023 · 2 comments
Open

IRC integration #777

haansn08 opened this issue Mar 1, 2023 · 2 comments

Comments

@haansn08
Copy link

haansn08 commented Mar 1, 2023

I have been following the guide at https://coq.zulipchat.com/integrations/doc/irc. After starting the bot like below and sending an IRC message, this exception occurred. No messages are relayed in either direction.

$ python irc-mirror.py --irc-server=irc.libera.chat --channel="#coq" --nick-prefix=irc_mirror --stream="#coq on irc.libera.chat" --site="https://coq.zulipchat.com" --user="[email protected]" --api-key="xxxxxxxxx"

Listening now. Please send an IRC message to verify operation
Unexpected error:
Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 761, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 444, in _error_catcher
    yield
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 828, in read_chunked
    self._update_chunk_length()
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 765, in _update_chunk_length
    raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/models.py", line 816, in generate
    yield from self.raw.stream(chunk_size, decode_content=True)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 624, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 816, in read_chunked
    with self._error_catcher():
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/response.py", line 461, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 777, in call_on_each_event
    res = self.get_events(queue_id=queue_id, last_event_id=last_event_id)
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 1146, in get_events
    return self.call_endpoint(
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 735, in call_endpoint
    return self.do_api_query(
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 655, in do_api_query
    res = self.session.request(
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/sessions.py", line 745, in send
    r.content
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/models.py", line 899, in content
    self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/models.py", line 818, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

Fatal error: protocol.data_received() call failed.
protocol: <irc.client_aio.IrcProtocol object at 0x7ffb7f98bac0>
transport: <_SelectorSocketTransport fd=7 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.10/ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.10/ssl.py", line 1130, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2548)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='coq.zulipchat.com', port=443): Max retries exceeded with url: /api/v1/messages (Caused by SSLError(SSLError(1, '[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2548)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 655, in do_api_query
    res = self.session.request(
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='coq.zulipchat.com', port=443): Max retries exceeded with url: /api/v1/messages (Caused by SSLError(SSLError(1, '[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2548)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 876, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client_aio.py", line 78, in data_received
    self.connection.process_data(data)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client_aio.py", line 186, in process_data
    self._process_line(line)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client.py", line 312, in _process_line
    handler(arguments, command, source, tags)
  File "/home/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client.py", line 356, in _handle_message
    self._handle_event(event)
  File "/home/zulip/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/zulip/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/zulip/python-zulip-api/zulip-api-py3-venv/lib/python3.10/site-packages/irc/client.py", line 1170, in _dispatcher
    method(connection, event)
  File "/home/zulip/python-zulip-api/zulip/integrations/bridge_with_irc/irc_mirror_backend.py", line 124, in on_pubmsg
    self.zulip_client.send_message(
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 865, in send_message
    return self.call_endpoint(
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 735, in call_endpoint
    return self.do_api_query(
  File "/home/zulip/python-zulip-api/zulip/zulip/__init__.py", line 677, in do_api_query
    raise UnrecoverableNetworkError("SSL Error")
zulip.UnrecoverableNetworkError: SSL Error
Exception in callback _SelectorSocketTransport._call_connection_lost(Unrecoverable...r('SSL Error'))
handle: <Handle _SelectorSocketTransport._call_connection_lost(Unrecoverable...r('SSL Error'))>
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 984, in _call_connection_lost
    super()._call_connection_lost(exc)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 742, in _call_connection_lost
    self._protocol.connection_lost(exc)
  File "/home/zulip/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/zulip/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/zulip/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/zulip/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/zulip/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/zulip/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'

On the IRC side, the bot joins the channel, but then misses a ping and is removed:

Mar 01 14:11:08 pluto biboumi[336]: IRC RECEIVING: (irc.libera.chat) IrcMessage[JOIN]{#coq}(from: [email protected])
Mar 01 14:15:17 pluto biboumi[336]: IRC RECEIVING: (irc.libera.chat) IrcMessage[QUIT]{Ping timeout: 246 seconds}(from: [email protected])
@asdf8dfafjk
Copy link

Same

@rht
Copy link
Contributor

rht commented Jun 2, 2023

I don't have access to a live bridge to test, but @asdf8dfafjk can you test if simply bumping the irc version works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants