Connection to rutorrent server as download client with rtorrent not working

Sonarr version (exact version): 3.0.8.1507
Mono version (if Sonarr is not running on Windows): 6.12.0.122
OS: Ubuntu/kubernetes
Debug logs:

Invalid request Validation failed: 
 -- : Failed to get the list of torrents: Unable to connect to rTorrent, please check your settings

and
Failed to get torrents: Unable to connect to rTorrent, please check your settings

NzbDrone.Core.Download.Clients.DownloadClientUnavailableException: Unable to connect to rTorrent, please check your settings ---> System.Net.WebException: Error getting response stream (ReadDoneAsync2): ReceiveFailure
  at System.Net.WebResponseStream.InitReadAsync (System.Threading.CancellationToken cancellationToken) [0x000f3] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Net.WebOperation.Run () [0x001d9] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Net.WebCompletionSource`1[T].WaitForCompletion () [0x00094] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x00016] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at CookComputing.XmlRpc.XmlRpcClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00014] in <a205b9da6b014c438c362c4bd859d7bc>:0 
  at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke (System.Object clientObj, System.Reflection.MethodInfo mi, System.Object[] parameters) [0x000fd] in <a205b9da6b014c438c362c4bd859d7bc>:0 
  at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke (System.Reflection.MethodInfo mi, System.Object[] Parameters) [0x00000] in <a205b9da6b014c438c362c4bd859d7bc>:0 
  at XmlRpcProxy33e4572c-371d-4569-8853-f2ae675281d1.TorrentMulticall (System.String[] parameters) [0x0001e] in <150099b2f0394db6926cccaeb53f63a3>:0 
  at NzbDrone.Core.Download.Clients.RTorrent.RTorrentProxy+<>c__DisplayClass3_0.<GetTorrents>b__0 () [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\Clients\rTorrent\RTorrentProxy.cs:83 
  at NzbDrone.Core.Download.Clients.RTorrent.RTorrentProxy.ExecuteRequest[T] (System.Func`1[TResult] task) [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\Clients\rTorrent\RTorrentProxy.cs:279 
   --- End of inner exception stack trace ---
  at NzbDrone.Core.Download.Clients.RTorrent.RTorrentProxy.ExecuteRequest[T] (System.Func`1[TResult] task) [0x0002d] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\Clients\rTorrent\RTorrentProxy.cs:292 
  at NzbDrone.Core.Download.Clients.RTorrent.RTorrentProxy.GetTorrents (NzbDrone.Core.Download.Clients.RTorrent.RTorrentSettings settings) [0x00023] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\Clients\rTorrent\RTorrentProxy.cs:83 
  at NzbDrone.Core.Download.Clients.RTorrent.RTorrent.TestGetTorrents () [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\Clients\rTorrent\RTorrent.cs:241 

Description of issue:
Hi, for past few months (didn’t have time to debug it) I just can’t add my rutorrent server. I’m getting the above error, but it’s not really helpful. I tried connecting with ssl, without ssl, with different url path, but nothing seems to work. I had the setup working up until January/February and didn’t change anything (you know setup and forget automation). For comparison I have the same setup in Radarr and everything works ok there (so there should be no problem with server). Can somebody help me with that since I’ve hit a brick wall

Just the error is not helpful nor are they debug logs

Provide the debug logs as the forum template asks for. The forum template links to the wiki for more info.

Hi, thanks for the reply. Here are the debug logs (but there is not much more) https://pastebin.com/p8mMxrma

Get trace please and don’t share the entire 2.2k line log file that’s not super helpful…follow the 6 steps on the wiki

Hi, so I turned on trace and copied big chunk before (as wiki says) the issue and some requests after (up until log download request) https://pastebin.com/x4DGrrrP. Still nothing I can make sense of :frowning:

then sounds like proxy, firewall, or some other network level event is causing the failure

I don’t think it’s a network issue, since it was working before and when I try to connect to the rutorrent server from the container via curl, it also works ok. And I have the same setup for radarr which works as well. And from the logs you can see the server is responding with error 400

2022-05-16 13:24:30.4|Trace|Http|Res: 24 [POST] /api/v3/downloadclient/test: 400.BadRequest (5507 ms)

The server is not responding with 400. Nothing in that line indicates it’s from the client or its server? Thats sonarr internally responding with 400 because it could not connect and thus failed to validate

Baker is correct, that is Sonarr responding to the test request with a 400 response (so the UI handles it as an error).

I can’t think of any recent changes in Sonarr that would cause this behaviour, this is something we saw with some versions of Mono, but that was around the 5.12 releases.

Hi, yes, make sense, that the 400 is from Sonarr, I agree.

However the network is working, because when I try it with curl from Sonarr container I get


ofc I’m getting 401, because I didn’t provide credentials. If I do I get 500 (because I didn’t send valid rpc request). But you see the network is ok and I can’t find any other clue on what could be the issue.

With debug and tracing logs, there should be something like couldn’t connect to upstream server or something, to confirm your suggestion, but I didn’t see anything like that. From Sonarr perspective everything looks ok

So after some try and error I found out it was indeed related to my VPN. I didn’t find the exact issue, but it seems Sonarr, didn’t work with my wireguard setup. Once I switched to openvpn it started to work :man_shrugging: