canonical / opensearch-operator

OpenSearch operator
Apache License 2.0
12 stars 7 forks source link

[LOW PRIORITY] AttributeError: 'NoneType' object has no attribute 'app' #422

Closed juditnovak closed 2 months ago

juditnovak commented 2 months ago

The issue occured when removing units from a non-established cluster. Thus the low priority. Intermittent issue, non-deterministic.

NOTE: Though one of the units concerned is IPv6, I it seems independent from the issue -- due to fully equal behavior experienced on the IPv4 unit equally.

Both peer units believe that the other one is still in the peer relation (see peer relation data below). While neither would find itself in the peer relation thus unable to determine deployment-description.

Steps to reproduce

  1. Deploy opensearch in a way the cluster is not established (see issue https://github.com/canonical/opensearch-operator/issues/416)
  2. juju remove-unit opensearch/N QUICKLY one after the other each unit.

Actual behavior

unit openserach/24: image

unit opensearch/25: image

Versions

Operating system:

Juju CLI:

Juju agent:

Charm revision:

LXD: image

Log output

Juju debug log, as indicated above:

nit-opensearch-25: 12:34:48 ERROR juju.worker.uniter.operation hook "opensearch-peers-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
unit-opensearch-25: 12:34:48 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-opensearch-24: 12:34:15 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-opensearch-24: 12:34:16 ERROR unit.opensearch/24.juju-log opensearch-peers:37: [Errno 111] Connection refused
unit-opensearch-24: 12:34:16 ERROR unit.opensearch/24.juju-log opensearch-peers:37: Cannot connect to the OpenSearch server...
unit-opensearch-24: 12:34:16 ERROR unit.opensearch/24.juju-log opensearch-peers:37: [Errno 111] Connection refused
unit-opensearch-24: 12:34:16 ERROR unit.opensearch/24.juju-log opensearch-peers:37: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-opensearch-24/charm/./src/charm.py", line 213, in <module>
    main(OpenSearchOperatorCharm)
  File "/var/lib/juju/agents/unit-opensearch-24/charm/venv/ops/main.py", line 551, in main
    manager.run()
  File "/var/lib/juju/agents/unit-opensearch-24/charm/venv/ops/main.py", line 530, in run
    self._emit()
  File "/var/lib/juju/agents/unit-opensearch-24/charm/venv/ops/main.py", line 516, in _emit
    self.framework.reemit()
  File "/var/lib/juju/agents/unit-opensearch-24/charm/venv/ops/framework.py", line 870, in reemit
    self._reemit()
  File "/var/lib/juju/agents/unit-opensearch-24/charm/venv/ops/framework.py", line 950, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-opensearch-24/charm/lib/charms/opensearch/v0/opensearch_base_charm.py", line 827, in _start_opensearch
    if not self.node_lock.acquired:
  File "/var/lib/juju/agents/unit-opensearch-24/charm/lib/charms/opensearch/v0/opensearch_locking.py", line 379, in acquired
    return self._peer.acquired
  File "/var/lib/juju/agents/unit-opensearch-24/charm/lib/charms/opensearch/v0/opensearch_locking.py", line 76, in acquired
    if self._unit_with_lock != self._charm.unit_name:
  File "/var/lib/juju/agents/unit-opensearch-24/charm/lib/charms/opensearch/v0/opensearch_base_charm.py", line 1573, in unit_name
    return format_unit_name(self.unit, app=self.opensearch_peer_cm.deployment_desc().app)
AttributeError: 'NoneType' object has no attribute 'app'
unit-opensearch-24: 12:34:16 ERROR juju.worker.uniter.operation hook "opensearch-peers-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
unit-opensearch-24: 12:34:16 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-opensearch-25: 12:34:42 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-opensearch-25: 12:34:42 ERROR unit.opensearch/25.juju-log opensearch-peers:37: [Errno 111] Connection refused
unit-opensearch-25: 12:34:42 ERROR unit.opensearch/25.juju-log opensearch-peers:37: Cannot connect to the OpenSearch server...
unit-opensearch-25: 12:34:42 ERROR unit.opensearch/25.juju-log opensearch-peers:37: [Errno 111] Connection refused
Cunit-opensearch-25: 12:34:53 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook
unit-opensearch-25: 12:34:53 ERROR unit.opensearch/25.juju-log opensearch-peers:37: [Errno 111] Connection refused
unit-opensearch-25: 12:34:53 ERROR unit.opensearch/25.juju-log opensearch-peers:37: Cannot connect to the OpenSearch server...
unit-opensearch-25: 12:34:53 ERROR unit.opensearch/25.juju-log opensearch-peers:37: [Errno 111] Connection refused
unit-opensearch-25: 12:34:53 ERROR unit.opensearch/25.juju-log opensearch-peers:37: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-opensearch-25/charm/./src/charm.py", line 213, in <module>
    main(OpenSearchOperatorCharm)
  File "/var/lib/juju/agents/unit-opensearch-25/charm/venv/ops/main.py", line 551, in main
    manager.run()
  File "/var/lib/juju/agents/unit-opensearch-25/charm/venv/ops/main.py", line 530, in run
    self._emit()
  File "/var/lib/juju/agents/unit-opensearch-25/charm/venv/ops/main.py", line 516, in _emit
    self.framework.reemit()
  File "/var/lib/juju/agents/unit-opensearch-25/charm/venv/ops/framework.py", line 870, in reemit
    self._reemit()
  File "/var/lib/juju/agents/unit-opensearch-25/charm/venv/ops/framework.py", line 950, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-opensearch-25/charm/lib/charms/opensearch/v0/opensearch_base_charm.py", line 827, in _start_opensearch
    if not self.node_lock.acquired:
  File "/var/lib/juju/agents/unit-opensearch-25/charm/lib/charms/opensearch/v0/opensearch_locking.py", line 379, in acquired
    return self._peer.acquired
  File "/var/lib/juju/agents/unit-opensearch-25/charm/lib/charms/opensearch/v0/opensearch_locking.py", line 76, in acquired
    if self._unit_with_lock != self._charm.unit_name:
  File "/var/lib/juju/agents/unit-opensearch-25/charm/lib/charms/opensearch/v0/opensearch_base_charm.py", line 1573, in unit_name
    return format_unit_name(self.unit, app=self.opensearch_peer_cm.deployment_desc().app)
AttributeError: 'NoneType' object has no attribute 'app'
unit-opensearch-25: 12:34:54 ERROR juju.worker.uniter.operation hook "opensearch-peers-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
unit-opensearch-25: 12:34:54 INFO juju.worker.uniter awaiting error resolution for "relation-broken" hook

Additional context

Debugger output confirming the missing relation: Screenshot from 2024-08-31 12-23-54

syncronize-issues-to-jira[bot] commented 2 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-5316.

This message was autogenerated

phvalguima commented 2 months ago

@juditnovak this issue is caused by the fact we have a single-node cluster and, at removal, it will clean its databag before running the final events and being eventually destroyed. Juju usptream issue: https://bugs.launchpad.net/juju/+bug/2076599

What you have here is the same problem as: canonical/opensearch-operator#444

Which means you have: (1) a start event being deferred; (2) you remove the unit or app; and (3) the start will not be able to succeed anymore. Closing this bug as we have fixed this problem. Feel free to re-open if we see it again.