canonical / mysql-operator

Machine charm for MySQL following the operator framework
https://charmhub.io/mysql
Apache License 2.0
7 stars 12 forks source link

Catch `TimeoutError` in retry for snap install #359

Open carlcsaposs-canonical opened 11 months ago

carlcsaposs-canonical commented 11 months ago

https://github.com/canonical/mysql-operator/actions/runs/7020160835/job/19103783474?pr=357#step:14:242

https://github.com/canonical/mysql-operator/blob/f8f49ddc9c1bbccfe2cad0eabaed3104bb970abc/src/charm.py#L567

probably should be fixed on snap lib—the exception we're getting is a socket timeouterror, not an exception from the snap lib

also probably affects router

carlcsaposs-canonical commented 11 months ago
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-mysql-0/charm/./src/charm.py", line 783, in <module>
    main(MySQLOperatorCharm)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/ops/main.py", line 436, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/ops/main.py", line 144, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/ops/framework.py", line 340, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/ops/framework.py", line 842, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/ops/framework.py", line 931, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-mysql-0/charm/./src/charm.py", line 180, in _on_install
    if self.install_workload():
  File "/var/lib/juju/agents/unit-mysql-0/charm/./src/charm.py", line 564, in install_workload
    for attempt in Retrying(
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/tenacity/__init__.py", line 347, in __iter__
    do = self.iter(retry_state=retry_state)
  File "/var/lib/juju/agents/unit-mysql-0/charm/venv/tenacity/__init__.py", line 314, in iter
    return fut.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/var/lib/juju/agents/unit-mysql-0/charm/./src/charm.py", line 571, in install_workload
    MySQL.install_and_configure_mysql_dependencies()
  File "/var/lib/juju/agents/unit-mysql-0/charm/src/mysql_vm_helpers.py", line 148, in install_and_configure_mysql_dependencies
    charmed_mysql = cache[CHARMED_MYSQL_SNAP_NAME]
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 795, in __getitem__
    self._snap_map[snap_name] = self._load_info(snap_name)
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 843, in _load_info
    info = self._snap_client.get_snap_information(name)
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 751, in get_snap_information
    return self._request("GET", "find", ***"name": name***)[0]
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 708, in _request
    response = self._request_raw(method, path, query, headers, data)
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 729, in _request_raw
    response = self.opener.open(request, timeout=self.timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/var/lib/juju/agents/unit-mysql-0/charm/lib/charms/operator_libs_linux/v1/snap.py", line 645, in http_open
    return self.do_open(_UnixSocketConnection, req, socket_path=self.socket_path)
  File "/usr/lib/python3.10/urllib/request.py", line 1352, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1375, 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)
TimeoutError: timed out

logs for history

juju-status.txt juju-debug-log.txt

github-actions[bot] commented 11 months ago

https://warthogs.atlassian.net/browse/DPE-3065