The Bug
RemoveContentCommand uses a separate new thread as executor:
It appears this is not thread-safe, mainly due to the issue.addRawRestrictedComment call which accesses the helper messages which are mutable and might be updated during regular execution.
Maybe there are also other parts which are not thread-safe; and even if that is not the case it is pretty error-prone.
Expected behavior
Not sure. I assume when #512 added the command the separate executor thread was used since content removal might be time intensive. We should probably check whether that is actually a problem. Having a separate executor thread would likely also make fixing #527 (respectively performing the necessary refactoring) more difficult.
Maybe we can use the normal execution thread for the content removal and, if necessary, adjust IssueUpdateContextCache#applyChanges (or its successor) to perform pauses when processing a large amount of updates.
The Bug
RemoveContentCommanduses a separate new thread as executor:arisa-kt/src/main/kotlin/io/github/mojira/arisa/modules/commands/CommandDispatcher.kt
Line 45 in e4a01f3
It appears this is not thread-safe, mainly due to the
issue.addRawRestrictedCommentcall which accesses the helper messages which are mutable and might be updated during regular execution.Maybe there are also other parts which are not thread-safe; and even if that is not the case it is pretty error-prone.
Expected behavior
Not sure. I assume when #512 added the command the separate executor thread was used since content removal might be time intensive. We should probably check whether that is actually a problem. Having a separate executor thread would likely also make fixing #527 (respectively performing the necessary refactoring) more difficult.
Maybe we can use the normal execution thread for the content removal and, if necessary, adjust
IssueUpdateContextCache#applyChanges(or its successor) to perform pauses when processing a large amount of updates.