jointakahe / takahe

An ActivityPub/Fediverse server
BSD 3-Clause "New" or "Revised" License
1.1k stars 84 forks source link

Blocked Domains trying to transition from updated to updated #620

Closed humrochagf closed 11 months ago

humrochagf commented 12 months ago

Hello, I noticed that now that we don't try to comunicate with blocked domains aac75dd4c3f9a5d4e17ab590c5dae421cc7c6591 and 83b57a0998d60fa3edef1d9395cda36b452f8e60 the blocked domains are trying to go from outdated to outdated and failing during this transition.

takahe-stator-1  | Traceback (most recent call last):
takahe-stator-1  |   File "/takahe/stator/runner.py", line 238, in clean_tasks
takahe-stator-1  |     task.result()
takahe-stator-1  |   File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 449, in result
takahe-stator-1  |     return self.__get_result()
takahe-stator-1  |            ^^^^^^^^^^^^^^^^^^^
takahe-stator-1  |   File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
takahe-stator-1  |     raise self._exception
takahe-stator-1  |   File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
takahe-stator-1  |     result = self.fn(*self.args, **self.kwargs)
takahe-stator-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
takahe-stator-1  |   File "/takahe/stator/runner.py", line 268, in task_transition
takahe-stator-1  |     result = instance.transition_attempt()
takahe-stator-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
takahe-stator-1  |   File "/takahe/stator/models.py", line 216, in transition_attempt
takahe-stator-1  |     raise ValueError(
takahe-stator-1  | ValueError: Cannot transition users.domain: blob.cat: from updated to updated - not a declared transition

Btw, I edited the error message code locally to show the target of the failure.

I'm not yet super familiar with the underlying stator code, so I'm not sure if this is caused by a race condition or other issue but I noticed that checking the domains after the error its state keeps as updated, but the state_next_attempt is not incremented so it keeps failing again periodically.

humrochagf commented 12 months ago

Just figured it out, the handle_updated was breaking the stator flow, I presised it in the PR above 😄

andrewgodwin commented 12 months ago

Actually, I think the right solution here is to allow that transition - I deliberately didn't want to move to outdated so that someone reading the logs might think we were communicating. Doing the transition will reset the timer to 7 days again, as well, so it shouldn't busy loop.

humrochagf commented 12 months ago

So, how to block it from failing and also to be constantly queued in the stator loop? Implement an updated to updated transition and send the next check to datetime max value? But also then if we need to unblock a domain, should we reset the date?

humrochagf commented 12 months ago

Ah ok got it. Accept the update to go through so the timer bumps 7 days, I'll follow this way.

humrochagf commented 12 months ago

Done, I reverted the change and allowed the updated to updated to happen 😃