LemmyNet/lemmy

Reducing log spam for duplicate activity submissions

jlandahl opened this issue · 2 comments

Requirements

  • Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a feature request? Do not put multiple feature requests in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
  • Do you agree to follow the rules in our Code of Conduct?

Is your proposal related to a problem?

As discussed in lemmy_support, I'm seeing a significant amount of log spam due to incoming activity submissions from lemmy.world. Logs appear to indicate that lemmy.world is sending the same submissions twice (see the video in the reply from Andrew, and note the presence of 400 errors in the reply showing an Nginx log excerpt).

Describe the solution you'd like.

I've looked into the source code, and I think a couple of lines to quietly ignore duplicate key errors would take care of the problem here:
https://github.com/LemmyNet/lemmy/blob/main/crates/apub/src/activities/community/announce.rs#L163.

I believe duplicate activity errors are coming from here, but the uses of ? on lines 47 and 53 of the same function could potentially return errors as well.

Instead of throwing the error with ? in announce.rs, the code could have an if or a pattern match to either ignore the error and skip the rest of the work, or maybe emit a quieter info or debug log message so that it doesn't look like a significant problem.

Describe alternatives you've considered.

The root of the problem seems to be the sending of duplicate activity entries, so that should also be researched and addressed. The proposal here would just make it easier on a Lemmy administrator (in terms of less log spam, less concern that a serious issue might be occurring) of an instance that is receiving duplicate entries from somewhere else.

Additional context

I'm new to the codebase, but now that I have a feel for what's happening I would be happy to add a fix for this. I just wanted to document the issue in case anyone else runs into it, or in case someone else has a better suggestion for a fix.

This is pretty low priority since it's not breaking anything, but as someone new to Lemmy I've found the logging to be verbose in a way that makes it hard to know if things are broken or not.

Looks like the duplication problem has been reported here: #4609

I believe this should be fixed on the sending side (#4609 as you mentioned).