It looks like someone is trying to flood your Tor relay by creating a large number of circuits? Tor comes with some defense parameters, and there’s an introduction link below.
I previously configured it to use all consensus default parameters (as follows), and since enabling these defenses I haven’t encountered any issues (other than my relay complaining in heartbeat messages that it killed a large number of DoS attack circuits).
Most likely, it targets some specific service, which is occasionally registered on my relay because of HSDir flag. When flag is gone, attack is gone as well.
Relay restart actually helps, but not immediately: after an hour attack stops and relay can be restarted once more to free more RAM.
Such properties make testing of different configuration parameters inconvenient. But I will keep in mind your suggestion and will try it if something changes. Thank you.
This reminds me of the attack vector mentioned here: the attacker’s goal is to DDoS a specific Onion service, but they do so by taking down the Tor guard relays and directory relays that the service relies on.
In this scenario, it no longer matters whether the attacker is targeting your relay or that ‘unknown Onion service’—you both end up as victims.