Closed RafalSiwek closed 7 months ago
Hi @RafalSiwek , although the PR makes sense, I believe that it will mask another issue. Please take a look a this comment on the original issue, as I thinks there's a better solution
Hi @paulomach, thank you for reviewing it. That's a valid point. However, I believe that since this method serves as a kind of health check, it might benefit from incorporating error handling, timeouts, or a retry policy, especially for the testing profile. The code calling this method assumes an errorless response and transitions the hook into an "action-required state" when an exception occurs:
if not self._mysql.is_mysqld_running():
# defer config-changed event until MySQL is running
logger.debug("Deferring config-changed event until MySQL is running")
event.defer()
return
While the Pebble ops
socket handler implements a timeout policy, it is not configurable. This issue addresses the lack of configurability.
Do you think implementing a testing profile-bound retry or handling ops.pebble.ConnectionError
errors would be a compatible approach in this case?
Issue
Charm deployment lands in an error state, mostly on GitHub Actions runners. The error is caused by
config-changed
hook failure when calling theis_mysqld_running
method.Error snippet out of `kubectl logs mysql-k8s`
``` unit-mysql-k8s-0: 16:48:16 ERROR unit.mysql-k8s/0.juju-log Uncaught exception while in charm code: Traceback (most recent call last): File "/var/lib/juju/agents/unit-mysql-k8s-0/charm/./src/charm.py", line 786, inSolution
Wrap
is_mysqld_running
method intenacity.retry
to implement retries onops.pebble.ConnectionError