darkalfx / requestrr

Requestrr is a chatbot used to simplify using services like Sonarr/Radarr/Ombi via the use of chat. Current platform is Discord only, but the bot was built around the ideology of quick adaptation for new features as well as new platforms.
MIT License
877 stars 102 forks source link

"The application did not respond" every time the container is restarted #185

Open Znuff opened 1 year ago

Znuff commented 1 year ago

Every now and then, Requestrr will just stop responding if I restart the container.

The docker compose logs requestrr will show:

fail: Requestrr.WebApi.RequestrrBot.ChatBot[0]
      An error occurred while sending a private message movie notification to a specific user: Unauthorized: 403
      DSharpPlus.Exceptions.UnauthorizedException: Unauthorized: 403
         at DSharpPlus.Net.DiscordApiClient.CreateMessageAsync(UInt64 channel_id, String content, IEnumerable`1 embeds, Nullable`1 replyMessageId, Boolean mentionReply, Boolean failOnInvalidReply)
         at Requestrr.WebApi.RequestrrBot.Notifications.Movies.PrivateMessageMovieNotifier.NotifyAsync(IReadOnlyCollection`1 userIds, Movie movie, CancellationToken token) in D:\Dev\Requestrr\requestrr\Requestrr.WebApi\RequestrrBot\Notifications\Movies\PrivateMessageMovieNotifier.cs:line 55
fail: Requestrr.WebApi.RequestrrBot.ChatBot[0]
      An error occurred while sending a private message movie notification to a specific user: Unauthorized: 403
      DSharpPlus.Exceptions.UnauthorizedException: Unauthorized: 403
         at DSharpPlus.Net.DiscordApiClient.CreateMessageAsync(UInt64 channel_id, String content, IEnumerable`1 embeds, Nullable`1 replyMessageId, Boolean mentionReply, Boolean failOnInvalidReply)
         at Requestrr.WebApi.RequestrrBot.Notifications.Movies.PrivateMessageMovieNotifier.NotifyAsync(IReadOnlyCollection`1 userIds, Movie movie, CancellationToken token) in D:\Dev\Requestrr\requestrr\Requestrr.WebApi\RequestrrBot\Notifications\Movies\PrivateMessageMovieNotifier.cs:line 55

Logging on the WebUI and hitting the Test button confirms that everything works right.

Restarting the container (again) will show:

requestrr  | [2023-10-18 01:33:45 +00:00] [0   /            ] [Crit ] There was an error registering application commands
requestrr  | System.ArgumentException: Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray')
requestrr  |    at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
requestrr  |    at System.Collections.Generic.List`1.set_Capacity(Int32 value)
requestrr  |    at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
requestrr  |    at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
requestrr  |    at DSharpPlus.SlashCommands.SlashCommandsExtension.<>c__DisplayClass39_0.<<RegisterCommands>b__0>d.MoveNext()

And then return An error occurred while sending a private message movie notification to a specific user: Unauthorized: 403 after a while.

Version is v2.1.2, running the darkalfx/requestrr image.

I have tried recreating the container, didn't help. Tried enabling Debugging, found nothing relevant.

Furthermore, on newly joined servers, the bot won't register commands on a new server until it's restarted.

Any advice on how to proceed further?

zetec commented 1 year ago

I just started having this behavior as well - it was working fine earlier today. Not sure what changed. Maybe a discord-side change?

Znuff commented 1 year ago

It happened again for me, today. Docker host was left without internet for about an hour. When it came back online, bot wasn't responding to any commands.

Tried, as usual, restarting the container, rebuilding it, testing & changing settings - nothing worked.

Decided to try something a bit more labor intensive, and I've build it with dotnet 7.0 and dsharpplus 4.4.2

I don't know if what I did made it work, or it's just "fixed" itself eventually.