ruTorrent icon indicating copy to clipboard operation
ruTorrent copied to clipboard

xmlrpc compatibility with rtorrent 0.16.2

Open allixx opened this issue 2 months ago • 57 comments

Please complete the following tasks.

  • [x] Web browser cache cleared
  • [x] Link provided to install script if applicable
  • [x] Not using broken rtinst install script
  • [x] Web browser, ruTorrent, PHP and OS version provided

Tell us about your environment

ruTorrent v5.2.10 rtorrent 0.16.1 (0.16.0 as well) built with tinyxml2

Tell us how you installed ruTorrent

Describe the bug

rTorrent is compiled with incorrect version of xmlrpc-c library, without i8 support. Version must be >= 1.11. Some functionality will be unavailable.
ratio: Plugin failed to start.

php error log receives the following error:

<?xml version="1.0"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><i8>-500</i8></value></member><member><name>faultString</name><value><string>invalid parameters: target must be a string</string></value></member></struct></value></fault></methodResponse>

Deleting ratio.dat does not help.

Previously ratio plugin worked fine on rtorrent 0.15.7/tinyxml2, with the same rTorrent 5.2.10.

I've no expertise in rtorrent xml rpc interface so I'm at a loss here.

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

allixx avatar Oct 16 '25 11:10 allixx

Unsure if related, but If i'm reading this correctly, rutorrent chooses group2 command prefix https://github.com/Novik/ruTorrent/blob/e839191876b8d950dc2c6617cdfb2b726979d44e/php/settings.php#L308

while deprecated group2 was removed in rtorrent 0.16.0: https://github.com/rakshasa/rtorrent/commit/48f82c17c2d91d2ef4dd3f1efefa34c27e72f465

EDIT: yeah, conditional handling rtorrent 0.16+ iVersion>4096 choosing group prefix is definitely required.

allixx avatar Oct 17 '25 18:10 allixx

Regarding incorrect version of xmlrpc-c library message, the reason is in this api call from php/settings.php, which fails for reason unknown. to_kb command is still valid and should work.

[2025-10-18 06:50:26] <?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>to_kb</methodName><params>
<param><value><i8>1024</i8></value></param>
</params></methodCall>
[2025-10-18 06:50:26] Status: 200 OK^M
Content-Type: text/xml
Content-Length: 284
^M
<?xml version="1.0"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><i8>-500</i8></value></member><member><name>faultString</name><value><string>invalid parameters: target must be a string</string></value></member></struct></value></fault></methodResponse>

Interestingly enough, the following rXMLRPCRequest call getting a batch system configuration details get_* succeeds just fine.

allixx avatar Oct 18 '25 06:10 allixx

So even with correct group. command prefix, and the following deprecated command renamings: ratio.min.set -> ratio.min ratio.max.set -> ratio.max ratio.upload.set -> ratio.upload

Ratio plugin's system.multicall batch configuration fails with <value><i8>-500</i8></value></member><member><name>faultString</name><value><string>invalid parameters: target must be a string</string></value> for each request entry.

And yet, despite the erroring call, one of configured ratios is applied to all torrents, not just the ones that had it assigned.

Bottomline: the reason is deprecation of old style "no target" commands by rtorrent.

allixx avatar Oct 18 '25 07:10 allixx

I tried to dirty-fix it, might not work properly, to be tested. I did not check if it would work with rtorrent version < 0.16.1 and I did not perform intensive testing on my side.

file php/settings.php

to fix the to_kb issue: from $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", floatval(1024)) ); to $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", array('',floatval(1024))) );

from: public function getRatioGroupCommand($ratio,$cmd,$args) { $prefix = ($this->iVersion >= 0x904) && in_array($cmd,$this->ratioCmds) ? "group2." : "group."; return( new rXMLRPCCommand( $prefix.$ratio.".".$cmd, $args ) ); }

to: public function getRatioGroupCommand($ratio,$cmd,$args) { $prefix = ($this->iVersion >= 0x904) && ($this->iVersion < 0x1001) && in_array($cmd,$this->ratioCmds) ? "group2." : "group."; if (!is_array($args)) $args = array('', $args); else array_unshift($args, ''); return( new rXMLRPCCommand( $prefix.$ratio.".".$cmd, $args ) ); }

it seems that commands that were working with parameters not linked directly to a torrent are potentially (not sure if it's all) expecting an empty string as first parameter. Don't know if it was an expected behavior, honestly I don't know if it makes sense, but this is the way to fix the problem.

in addition, group2 was still used for few commands while not available anymore - don't know exactly the purpose of the $ratioCmds to be honest. I fixed this by checking the version of rtorrent (0x1001 should be equivalent to version 0.16.1)

thanks

kouze avatar Oct 19 '25 13:10 kouze

I tried to dirty-fix it

Hey, good finding! Thanks. This new args requirement makes zero sense to me as well, but it works so I call it a win!

--- a/php/settings.php
+++ b/php/settings.php
@@ -229,8 +229,10 @@ class rTorrentSettings
                                if($req->success())
                                        $this->apiVersion = $req->val[0];
                        }
-
-                        $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", floatval(1024)) );
+                       $req = new rXMLRPCRequest(new rXMLRPCCommand(
+                               "convert.kb",
+                               $this->iVersion >= 0x1000 ? array('',floatval(1024)) : floatval(1024)
+                       ));
                        if($req->run())
                        {
                                if(!$req->fault)
@@ -305,7 +307,13 @@ class rTorrentSettings
        }
        public function getRatioGroupCommand($ratio,$cmd,$args)
        {
-               $prefix = ($this->iVersion >= 0x904) && in_array($cmd,$this->ratioCmds) ? "group2." : "group.";
+               if (($this->iVersion >= 0x904) && ($this->iVersion < 0x1000) && in_array($cmd,$this->ratioCmds)) {
+                       $prefix = "group2.";
+               } else {
+                       $prefix = "group.";
+                       if (!is_array($args))
+                               $args = array('', $args);
+               }
                return( new rXMLRPCCommand( $prefix.$ratio.".".$cmd, $args ) );
        }
        public function getEventCommand($cmd1,$cmd2,$args)```

allixx avatar Oct 19 '25 14:10 allixx

Does this actually work for you after that patch? My 0.16.1 rtorrent is refusing to perform most group.rat_x.ratio commands that the plugin tries to perform :/ I even tried them manually in rtorrent and they failed.

W-Hamra avatar Oct 20 '25 14:10 W-Hamra

Sure, it works correctly. One thing to mention, that I'm using tinyxml2. xmlrpc-c experience was not great starting from 0.15.x: https://github.com/Novik/ruTorrent/discussions/2852

allixx avatar Oct 20 '25 15:10 allixx

Sure, it works correctly. One thing to mention, that I'm using tinyxml2. xmlrpc-c experience was not great starting from 0.15.x: #2852

That's exactly what I'm facing! Thanks for the tip. I'll adjust.

W-Hamra avatar Oct 20 '25 15:10 W-Hamra

Why have you been using commands that have been marked as deprecated for 15+ years?

No frontend or plugin should be using the short / aliased versions of commands, like to_kb, execute or group..

They were deprecated 15+years ago, with the ultimate plan to reinstate them as proper versions after a long enough time passed that everyone had migrated.

Now was when a long enough time had passed.

rakshasa avatar Oct 26 '25 09:10 rakshasa

Installed the rtorrent 0.16.1 and I saw many issues in rutorrent. Portcheck also did not work. Did the code changes to get ratio plugin to load, but changing group ultimately failed. So i go back to rtorrent 0.15.6 where everything still working. So there are probably many more issues in rutorrent with rtorrent 0.16+ versions. Dont have time for now to figure everything out to get new rtorrent work so i just go back to older version.

ranirahn avatar Oct 28 '25 09:10 ranirahn

"convert.kb", $this->iVersion >= 0x1000 ? array('',floatval(1024)) : floatval(1024)

convert.* has always required targets, so the version check is wrong afaicr.

if (($this->iVersion >= 0x904) && ($this->iVersion < 0x1000) && in_array($cmd,$this->ratioCmds)) $prefix = "group2.";

Just use group2. to avoid this mess, and why are you bothering to support <= 0x904? Are anyone still using that?

rakshasa avatar Nov 01 '25 10:11 rakshasa

Just use group2. to avoid this mess

group2 doesn't work without unknown additional modifications (ratio commands has to be renamed or grouped differently I suspect), with or without target.

rutorrent code has a fair chunk of version checks not relevant anymore, perhaps it will be dealt with if (or when) work on next major version starts, bumping minimal rtorrent compatibility level to 0x1000+. I have zero knowledge about rtorrent xml rpc interface and its rutorrent implementation, I'm speaking from practical side of solving own problems.

allixx avatar Nov 01 '25 12:11 allixx

Looks like group2.* are wrongly marked NO_EXPORT, which means they aren't accessible from RPC. Will fix this.

rakshasa avatar Nov 01 '25 12:11 rakshasa

With https://github.com/rakshasa/rtorrent/commit/184ead294a9331dfd3ec32c61c32ce97df8d31dd , the only "fix" needed is:

--- a/php/settings.php
+++ b/php/settings.php
@@ -230,7 +230,11 @@ class rTorrentSettings
 					$this->apiVersion = $req->val[0];
 			}
 
-                        $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", floatval(1024)) );
+			$req = new rXMLRPCRequest(new rXMLRPCCommand(
+				"convert.kb",
+				array('',floatval(1024))
+			));
+
 			if($req->run())
 			{
 				if(!$req->fault)```

allixx avatar Nov 01 '25 15:11 allixx

diff --git a/js/content.js b/js/content.js
index 7f734455..b19da962 100644
--- a/js/content.js
+++ b/js/content.js
@@ -851,6 +851,17 @@ function correctContent()
                        "load"                  :       { name: "load.normal", prm: 1 }
                });
        }
+       if(theWebUI.systemInfo.rTorrent.iVersion>=0x1002)
+       {
+               $.extend(theRequestManager.aliases,
+               {
+                       "dht",                                                  :       { name: "dht.mode.set", prm: 1 },
+                       "throttle.max_uploads.div"              :       { name: "throttle.max_uploads.div._val", prm: 1 },
+                       "throttle.max_uploads.global"   :       { name: "throttle.max_uploads.global._val", prm: 1 },
+                       "throttle.max_downloads.div"    :       { name: "throttle.max_downloads.div._val", prm: 1 },
+                       "throttle.max_downloads.global" :       { name: "throttle.max_downloads.global._val", prm: 1 }
+        });
+    }
        if(theWebUI.systemInfo.rTorrent.iVersion < 0x907) {
                const title = theUILang.requiresAtLeastRtorrent.replace('{version}', 'v0.9.7');
                $($$('webui.show_open_status')).attr({ disabled: '', title });
diff --git a/php/methods-0.10.2.php b/php/methods-0.10.2.php
new file mode 100644
index 00000000..58cbbbdb
--- /dev/null
+++ b/php/methods-0.10.2.php
@@ -0,0 +1,9 @@
+<?php
+
+$this->aliases = array_merge($this->aliases,array(
+"dht",                                                 =>      array( "name"=>"dht.mode.set", "prm"=>1 ),
+"throttle.max_uploads.div"             =>      array( "name"=>"throttle.max_uploads.div._val", "prm"=>1 ),
+"throttle.max_uploads.global"  =>      array( "name"=>"throttle.max_uploads.global._val", "prm"=>1 ),
+"throttle.max_downloads.div"   =>      array( "name"=>"throttle.max_downloads.div._val", "prm"=>1 ),
+"throttle.max_downloads.global"        =>      array( "name"=>"throttle.max_downloads.global._val", "prm"=>1 ),
+));
diff --git a/php/settings.php b/php/settings.php
index c8ee7757..4ff8c9fb 100644
--- a/php/settings.php
+++ b/php/settings.php
@@ -220,6 +220,10 @@ class rTorrentSettings
                        {
                                require_once( 'methods-0.9.4.php' );
                        }
+                       if($this->iVersion>=0x1002)
+                       {
+                               require_once( 'methods-0.10.2.php' );
+                       }
                        
                        $this->apiVersion = 0;
                        if($this->iVersion>=0x901)
@@ -230,7 +234,11 @@ class rTorrentSettings
                                        $this->apiVersion = $req->val[0];
                        }
 
-                        $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", floatval(1024)) );
+                       $req = new rXMLRPCRequest(new rXMLRPCCommand(
+                               "convert.kb",
+                               array('',floatval(1024))
+                       ));
+
                        if($req->run())
                        {
                                if(!$req->fault)

This seems to cover everything that was deprecated.

Not tested, and the release version isn't available atm. (rolling a new release asap)

Although the "throttle.max_uploads.div, etc, might not be needed. So might be just a matter of also doing dht to dht.mode.set in the code.

rakshasa avatar Nov 04 '25 10:11 rakshasa

diff --git a/js/rtorrent.js b/js/rtorrent.js
index a137ddba..8eace0b2 100644
--- a/js/rtorrent.js
+++ b/js/rtorrent.js
@@ -379,7 +379,8 @@ rTorrentStub.prototype.setsettings = function()
                        else
                                prm = "auto";
                        prmType = "string";
-                       cmd = new rXMLRPCCommand('dht');
+                       cmd = new rXMLRPCCommand('dht.mode.set');
+                       cmd.addParameter("string",'');
                }
                else
                        cmd = new rXMLRPCCommand('set_'+this.ss[i].substr(1));
diff --git a/php/settings.php b/php/settings.php
index c8ee7757..a44ab2a7 100644
--- a/php/settings.php
+++ b/php/settings.php
@@ -230,7 +230,11 @@ class rTorrentSettings
                                        $this->apiVersion = $req->val[0];
                        }
 
-                        $req = new rXMLRPCRequest( new rXMLRPCCommand("to_kb", floatval(1024)) );
+                       $req = new rXMLRPCRequest(new rXMLRPCCommand(
+                               "convert.kb",
+                               array('',floatval(1024))
+                       ));
+
                        if($req->run())
                        {
                                if(!$req->fault)

rakshasa avatar Nov 04 '25 11:11 rakshasa

Made the file changes and installed rtorrent 0.16.2 and rutorrent give me error.

[05.11.2025 13:08:01] Bad response from server: (500 [error,getplugins]) Internal Server Error

Looked at the logs and found out that in the new methods-0.10.2.php file had little typo

after "dht" there was a coma and rutorrent crached. After removing that, it looks like everything is working. Same thing in content.js. where also had extra coma.

Right code blocks.

<?php

$this->aliases = array_merge($this->aliases,array(
"dht"									=>		array( "name"=>"dht.mode.set", "prm"=>1 ),
"throttle.max_uploads.div"				=>		array( "name"=>"throttle.max_uploads.div._val", "prm"=>1 ),
"throttle.max_uploads.global"			=>		array( "name"=>"throttle.max_uploads.global._val", "prm"=>1 ),
"throttle.max_downloads.div"			=>		array( "name"=>"throttle.max_downloads.div._val", "prm"=>1 ),
"throttle.max_downloads.global"			=>		array( "name"=>"throttle.max_downloads.global._val", "prm"=>1 ),
));
		if(theWebUI.systemInfo.rTorrent.iVersion>=0x1002)
		{
			$.extend(theRequestManager.aliases,
			{
				"dht"							:		{ name: "dht.mode.set", prm: 1 },
				"throttle.max_uploads.div"		:		{ name: "throttle.max_uploads.div._val", prm: 1 },
				"throttle.max_uploads.global"	:		{ name: "throttle.max_uploads.global._val", prm: 1 },
				"throttle.max_downloads.div"	:		{ name: "throttle.max_downloads.div._val", prm: 1 },
				"throttle.max_downloads.global"	:		{ name: "throttle.max_downloads.global._val", prm: 1 }
			});
		}

Someone needs to make pull request to rutorrent then 😆

stickz Have not been active sins july so who is managing this project now?

ranirahn avatar Nov 05 '25 11:11 ranirahn

It would be better if you test the last diff I posted as it changes less, and is afaict compatible with 0.9.8.

rakshasa avatar Nov 05 '25 12:11 rakshasa

Well, I did both changes. So you say I only needed just one of them? 😆

ranirahn avatar Nov 05 '25 12:11 ranirahn

Looks like the connection with rtorrent dont work now. activated xmlrpc.log and this is what I see right now.

 71:CONTENT_LENGTH 805 CONTENT_TYPE text/xml SCGI 1 UNTRUSTED_CONNECTION 1 ,<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data>
<value><struct><member><name>methodName</name><value><string>network.http.current_open</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>network.open_sockets</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>network.open_files</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
</data></array></value></param></params></methodCall>
---
 Status: 200 OK
Content-Type: text/xml
Content-Length: 340

<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data><value><i8>1243</i8></value></data></array></value><value><array><data><value><i8>299</i8></value></data></array></value><value><array><data><value><i8>600</i8></value></data></array></value></data></array></value></param></params></methodResponse>
---
 72:CONTENT_LENGTH 1035 CONTENT_TYPE text/xml SCGI 1 UNTRUSTED_CONNECTION 1 ,<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data>
<value><struct><member><name>methodName</name><value><string>throttle.global_up.total</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>throttle.global_down.total</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>throttle.global_up.max_rate</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>throttle.global_down.max_rate</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
</data></array></value></param></params></methodCall>
---
 Status: 200 OK
Content-Type: text/xml
Content-Length: 411

<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data><value><i8>111744</i8></value></data></array></value><value><array><data><value><i8>113830</i8></value></data></array></value><value><array><data><value><i8>0</i8></value></data></array></value><value><array><data><value><i8>0</i8></value></data></array></value></data></array></value></param></params></methodResponse>
---
 

Changing Label dont work sometimes. Sometimes it reverts back. Adding or changing ratiogroup have same problem. Its probably all because unstable connection with rtorrent. I dont know how to fix this. I probably need to go back to rtorrent that worked so far that i could use it. Right now i cant start added torrent and torrents missing timestamps and labels and stuff that were added with flexget. Something is wrong with rtorrent still.

ranirahn avatar Nov 06 '25 11:11 ranirahn

    CMD2_REDIRECT_GENERIC("ratio.enable",     "group.seeding.ratio.enable");
    CMD2_REDIRECT_GENERIC("ratio.disable",    "group.seeding.ratio.disable");
    CMD2_REDIRECT_GENERIC("ratio.min",        "group2.seeding.ratio.min");
    CMD2_REDIRECT_GENERIC("ratio.max",        "group2.seeding.ratio.max");
    CMD2_REDIRECT_GENERIC("ratio.upload",     "group2.seeding.ratio.upload");
    CMD2_REDIRECT_GENERIC("ratio.min.set",    "group2.seeding.ratio.min.set");
    CMD2_REDIRECT_GENERIC("ratio.max.set",    "group2.seeding.ratio.max.set");
    CMD2_REDIRECT_GENERIC("ratio.upload.set", "group2.seeding.ratio.upload.set");
    CMD2_REDIRECT_GENERIC("connection_leech", "protocol.connection.leech.set");
    CMD2_REDIRECT_GENERIC("connection_seed",  "protocol.connection.seed.set");

These are some of the command aliases that have been removed.

If you add those to the patch I posted above it should work, as the last two specifically would (afaict) affect labels.

rakshasa avatar Nov 06 '25 12:11 rakshasa

Edit: Ilma rutorrenti koodi muutmata. Ehk siis jätsin need muudatused sisse, mis ma siit sain ja panin rtorrent 0.15.6 omale tagasi ja kõik funktsioonid töötasid edukalt.

Võimalik, et kõik siin nii vabalt eesti keelt ei oska.

freultwah avatar Nov 06 '25 17:11 freultwah

After changing the code I still could not get it working stable. in rutorrent i see errors like this.

[07.11.2025 09:04:15] Bad response from server: (500 [error,list]) Link to XMLRPC failed. Maybe, rTorrent is down?
[07.11.2025 09:04:15] Bad response from server: (500 [error,gettotal]) Link to XMLRPC failed. Maybe, rTorrent is down?
[07.11.2025 09:04:15] Bad response from server: (500 [error,getopen]) Link to XMLRPC failed. Maybe, rTorrent is down?

So common nominater is the link to xmlrpc. With rtorrent 0.15.7 dont see any problems. I hope someone who understands the changes and connection between rtorrent and rutorrent better look into it and fix this.

Edit:

Now I have been testing my changes all day and it looks like everything working until I let rutorrent work on background and when I return nothing is working. Then after browser refresh everything is working again. methods-0.10.2.php looks like this right now.

<?php
$this->aliases = array_merge($this->aliases,array(
"dht"                    => array( "name"=>"dht.mode.set",                     "prm"=>1 ),
"throttle.max_uploads.div"     => array( "name"=>"throttle.max_uploads.div._val",     "prm"=>1 ),
"throttle.max_uploads.global"  => array( "name"=>"throttle.max_uploads.global._val",  "prm"=>1 ),
"throttle.max_downloads.div"   => array( "name"=>"throttle.max_downloads.div._val",   "prm"=>1 ),
"throttle.max_downloads.global"=> array( "name"=>"throttle.max_downloads.global._val","prm"=>1 ),
"ratio.enable"           => array( "name"=>"group.seeding.ratio.enable",      "prm"=>1 ),
"ratio.disable"          => array( "name"=>"group.seeding.ratio.disable",     "prm"=>1 ),
"ratio.min"              => array( "name"=>"group2.seeding.ratio.min.set",     "prm"=>1, "extra"=>",0" ),
"ratio.max"              => array( "name"=>"group2.seeding.ratio.max.set",     "prm"=>1, "extra"=>",0" ),
"ratio.upload"           => array( "name"=>"group2.seeding.ratio.upload.set",  "prm"=>1, "extra"=>",0" ),
"ratio.min.set"          => array( "name"=>"group2.seeding.ratio.min.set",     "prm"=>1, "extra"=>",0" ),
"ratio.max.set"          => array( "name"=>"group2.seeding.ratio.max.set",     "prm"=>1, "extra"=>",0" ),
"ratio.upload.set"       => array( "name"=>"group2.seeding.ratio.upload.set",  "prm"=>1, "extra"=>",0" ),
"connection_leech"       => array( "name"=>"protocol.connection.leech.set",   "prm"=>1 ),
"connection_seed"        => array( "name"=>"protocol.connection.seed.set",    "prm"=>1 ),
));

and in content.js on rows 854 to 873 is this.

if(theWebUI.systemInfo.rTorrent.iVersion >= 0x1002)
	{
		$.extend(theRequestManager.aliases, {
			"dht"                     : { name: "dht.mode.set",                     prm: 1 },
			"throttle.max_uploads.div"        : { name: "throttle.max_uploads.div._val",        prm: 1 },
			"throttle.max_uploads.global"     : { name: "throttle.max_uploads.global._val",     prm: 1 },
			"throttle.max_downloads.div"      : { name: "throttle.max_downloads.div._val",      prm: 1 },
			"throttle.max_downloads.global"   : { name: "throttle.max_downloads.global._val",   prm: 1 },
			"ratio.enable"                    : { name: "group.seeding.ratio.enable",          prm: 1 },
			"ratio.disable"                   : { name: "group.seeding.ratio.disable",         prm: 1 },
			"ratio.min"                       : { name: "group2.seeding.ratio.min.set",        prm: 1, extra: ",0" },
			"ratio.max"                       : { name: "group2.seeding.ratio.max.set",        prm: 1, extra: ",0" },
			"ratio.upload"                    : { name: "group2.seeding.ratio.upload.set",     prm: 1, extra: ",0" },
			"ratio.min.set"                   : { name: "group2.seeding.ratio.min.set",        prm: 1, extra: ",0" },
			"ratio.max.set"                   : { name: "group2.seeding.ratio.max.set",        prm: 1, extra: ",0" },
			"ratio.upload.set"                : { name: "group2.seeding.ratio.upload.set",     prm: 1, extra: ",0" },
			"connection_leech"                : { name: "protocol.connection.leech.set",       prm: 1 },
			"connection_seed"                 : { name: "protocol.connection.seed.set",        prm: 1 }
		});
	}

I have no idea what I am doing 😆

Edit2: Another thing that I noticed is when flexget adds new torrents they have no added time, and no ratiogroup and default location not the one was set in flexget. Dont know if its issue with rutorrent or flexget. Anyway I cant use rtorrent 0.16.2 with all these issues.

ranirahn avatar Nov 07 '25 07:11 ranirahn

After changing the code I still could not get it working stable. in rutorrent i see errors like this.

I tested with modifications suggested by rakshasa and all seems good (no more incorrect version of xmlrpc-c library warning) except that ratio or extratio plugin still return -500 Wrong object type after a system.multicall request when I assign a ratio group to a torrent.

Code that raise the error may be one of those :

plugins/ratio/init.js

$out->addCommand( new rXMLRPCCommand('d.views.push_back_unique', array($hash, $rule->ratio) ) );
$out->addCommand( new rXMLRPCCommand('view.set_visible', array($hash, $rule->ratio) ) );

or plugins/extratio/rules.php

cmd = new rXMLRPCCommand('d.views.push_back_unique');
cmd.addParameter("string",this.hashes[i]);
cmd.addParameter("string","rat_"+this.vs[i]);
this.commands.push( cmd );
cmd = new rXMLRPCCommand('view.set_visible');
cmd.addParameter("string",this.hashes[i]);
cmd.addParameter("string","rat_"+this.vs[i]);
this.commands.push( cmd );

simonc56 avatar Nov 09 '25 21:11 simonc56

plugins/ratio/init.js

$out->addCommand( new rXMLRPCCommand('d.views.push_back_unique', array($hash, $rule->ratio) ) ); $out->addCommand( new rXMLRPCCommand('view.set_visible', array($hash, $rule->ratio) ) );

https://github.com/rakshasa/rtorrent/commit/449271573780cc452844a43a9e6dc32d7f0822a7

d.views.push_back_unique was made to strictly require string arguments due to a bug.

$rule->ratio might be an array containing a string. The code above should probably check and if it is, just pass the string.

feature/object-type-names branch now adds the expected and actual type names to the error message, so try that.

rakshasa avatar Nov 10 '25 09:11 rakshasa

Now I have been testing my changes all day and it looks like everything working until I let rutorrent work on background and when I return nothing is working. Then after browser refresh everything is working again.

I have noticed this issue myself prior to the deprecation of these commands, so it isn't related.

Most likely it is related to the changes made to SCGI threading prior to this. Make a new issue for rtorrent, and include rpc_events and rpc_dump logs if possible.

rakshasa avatar Nov 10 '25 09:11 rakshasa

I have noticed this issue myself prior to the deprecation of these commands, so it isn't related.

Most likely it is related to the changes made to SCGI threading prior to this. Make a new issue for rtorrent, and include rpc_events and rpc_dump logs if possible.

I have been compiling rtorrent with tinyxml not xmlrpc-c. And I dont see any issues with rtorrent 0.15.7. My biggest problem right now is that new torrents dont have added times and they go at the end of the torrent list because of that and also data is saved on default location not what I set it. If everyone else dont have this problem then I need to find out why its doing this only for me. Dont see any errors on xmlrpc.log. So I dont know what is the issue with my rutorrent+rtorrent combo.

ranirahn avatar Nov 10 '25 12:11 ranirahn

Use the log outputs I posted above, check for rpc commands that fail.

rakshasa avatar Nov 10 '25 13:11 rakshasa

plugins/ratio/init.js $out->addCommand( new rXMLRPCCommand('d.views.push_back_unique', array($hash, $rule->ratio) ) ); $out->addCommand( new rXMLRPCCommand('view.set_visible', array($hash, $rule->ratio) ) );

rakshasa/rtorrent@4492715

d.views.push_back_unique was made to strictly require string arguments due to a bug.

$rule->ratio might be an array containing a string. The code above should probably check and if it is, just pass the string.

feature/object-type-names branch now adds the expected and actual type names to the error message, so try that.

Ratio is already a string, here is a simple example of payload without array that raises Wrong object type. :

<?xml version="1.0"?>
<methodCall>
  <methodName>d.views.push_back_unique</methodName>
  <params>
    <param>
      <value><string>F66A2CCEA7812BCDCEE31DD5A75B0121638348CA</string></value>
    </param>
    <param>
      <value><string>rat_7</string></value>
    </param>
  </params>
</methodCall>

simonc56 avatar Nov 10 '25 18:11 simonc56

I see same thing. But after I refresh my browser it gives same faultString "Wrong object type." but will change the ratiogroup. I just dont get it why it is happening when rutorrent works on background. And also I see many logs in rutorrent like

[10.11.2025 21:20:07] The request to rTorrent has timed out.
[10.11.2025 21:27:16] Bad response from server: (500 [error,list]) Link to XMLRPC failed. Maybe, rTorrent is down?
[10.11.2025 21:29:17] Connection to rTorrent established.

Dont see any other issues in the rtorrent logs. I can send the log where rpc_event and rpc_dump is logged. But in short the important part of the log is this I think

1762803586 scgi
---DUMP---
Status: 200 OK
Content-Type: text/xml
Content-Length: 411

<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data><value><i8>241779</i8></value></data></array></value><value><array><data><value><i8>182208</i8></value></data></array></value><value><array><data><value><i8>0</i8></value></data></array></value><value><array><data><value><i8>0</i8></value></data></array></value></data></array></value></param></params></methodResponse>
---END---
1762803586 scgi
---DUMP---
<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data>
<value><struct><member><name>methodName</name><value><string>network.http.current_open</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>network.open_sockets</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
<value><struct><member><name>methodName</name><value><string>network.open_files</string></value></member><member><name>params</name><value><array><data>
</data></array></value></member></struct></value>
</data></array></value></param></params></methodCall>
---END---
1762803586 scgi
---DUMP---
Status: 200 OK
Content-Type: text/xml
Content-Length: 337

<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data><value><i8>10</i8></value></data></array></value><value><array><data><value><i8>37</i8></value></data></array></value><value><array><data><value><i8>259</i8></value></data></array></value></data></array></value></param></params></methodResponse>
---END---
1762803590 scgi
---DUMP---
<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct><member><name>methodName</name><value><string>d.views.push_back_unique</string></value></member><member><name>params</name><value><array><data><value><string>DD78EE36BFD8557A20D0B689CC77E0C551346A1C</string></value><value><string>rat_4</string></value></data></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>view.set_visible</string></value></member><member><name>params</name><value><array><data><value><string>DD78EE36BFD8557A20D0B689CC77E0C551346A1C</string></value><value><string>rat_4</string></value></data></array></value></member></struct></value></data></array></value></param></params></methodCall>
---END---
1762803590 scgi
---DUMP---
Status: 200 OK
Content-Type: text/xml
Content-Length: 517

<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><struct><member><name>faultCode</name><value><i8>-500</i8></value></member><member><name>faultString</name><value><string>Wrong object type.</string></value></member></struct></value><value><struct><member><name>faultCode</name><value><i8>-500</i8></value></member><member><name>faultString</name><value><string>Could not find view: rat_4</string></value></member></struct></value></data></array></value></param></params></methodResponse>
---END---
1762803590 scgi
---DUMP---
<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>d.multicall2</methodName><params>
<param><value><string></string></value></param>
<param><value><string>main</string></value></param>
<param><value><string>d.hash=</string></value></param>
<param><value><string>d.is_open=</string></value></param>
<param><value><string>d.is_hash_checking=</string></value></param>
<param><value><string>d.is_hash_checked=</string></value></param>
<param><value><string>d.state=</string></value></param>
<param><value><string>d.name=</string></value></param>
<param><value><string>d.size_bytes=</string></value></param>
<param><value><string>d.completed_chunks=</string></value></param>
<param><value><string>d.size_chunks=</string></value></param>
<param><value><string>d.bytes_done=</string></value></param>
<param><value><string>d.up.total=</string></value></param>
<param><value><string>d.ratio=</string></value></param>
<param><value><string>d.up.rate=</string></value></param>
<param><value><string>d.down.rate=</string></value></param>
<param><value><string>d.chunk_size=</string></value></param>
<param><value><string>d.custom1=</string></value></param>
<param><value><string>d.peers_accounted=</string></value></param>
<param><value><string>d.peers_not_connected=</string></value></param>
<param><value><string>d.peers_connected=</string></value></param>
<param><value><string>d.peers_complete=</string></value></param>
<param><value><string>d.left_bytes=</string></value></param>
<param><value><string>d.priority=</string></value></param>
<param><value><string>d.state_changed=</string></value></param>
<param><value><string>d.skip.total=</string></value></param>
<param><value><string>d.hashing=</string></value></param>
<param><value><string>d.chunks_hashed=</string></value></param>
<param><value><string>d.base_path=</string></value></param>
<param><value><string>d.creation_date=</string></value></param>
<param><value><string>d.tracker_size=</string></value></param>
<param><value><string>d.is_active=</string></value></param>
<param><value><string>d.message=</string></value></param>
<param><value><string>d.custom2=</string></value></param>
<param><value><string>d.free_diskspace=</string></value></param>
<param><value><string>d.is_private=</string></value></param>
<param><value><string>d.is_multi_file=</string></value></param>
<param><value><string>d.throttle_name=</string></value></param>
<param><value><string>d.custom=chk-state</string></value></param>
<param><value><string>d.custom=chk-time</string></value></param>
<param><value><string>d.custom=sch_ignore</string></value></param>
<param><value><string>cat="$t.multicall=d.hash=,t.scrape_complete=,cat={#}"</string></value></param>
<param><value><string>cat="$t.multicall=d.hash=,t.scrape_incomplete=,cat={#}"</string></value></param>
<param><value><string>d.custom=x-pushbullet</string></value></param>
<param><value><string>cat=$d.views=</string></value></param>
<param><value><string>d.custom=seedingtime</string></value></param>
<param><value><string>d.custom=addtime</string></value></param>
</params></methodCall>
---END---

What is also interesting is in the next rtorrent.log file the rat_x value is missing for this hash again, but no faultcodes. So even if it looks like its working after refresh it does not. I dont know what makes rtorrent start new log file, but at the same time it forgets the ratiogroup value that I already saw in the last log.

ranirahn avatar Nov 10 '25 19:11 ranirahn