ShokoAnime / ShokoServer

Repository for Shoko Server.
http://shokoanime.com/shoko-server/
MIT License
391 stars 75 forks source link

Feature request: Add receive timeout to UDP AniDBSocketHandler #1121

Closed LordFlashmeow closed 1 month ago

LordFlashmeow commented 5 months ago

VERSION INFORMATION

Server Version: Daily

DESCRIPTION

_aniDBSocket.ReceiveFromAsync can hang on network disconnect, blocking the UDP worker. Attempting to ctrl-c the server is ineffective, because the logout process tries to send a UDP logout message (which gets blocked behind the frozen socket).

https://github.com/ShokoAnime/ShokoServer/blob/289021ddfa69045155956a7b3d099187d009d3d9/Shoko.Server/Providers/AniDB/UDP/AniDBSocketHandler.cs#L75

LordFlashmeow commented 5 months ago

1122 implements the timeouts, which seems to fix the issue when a connection is dropped (or the server wakes up from sleep). However, 598 UNKNOWN COMMAND responses show up instead, but at least the server is ctrl-cable now.

ElementalCrisis commented 5 months ago

@fearnlj01, tagged you since you made the initial fix, is this something we can also address?

da3dsoul commented 5 months ago

I know how to fix it, theoretically. I just need time