How to debug RPC requests?

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
dredkin
Posts: 2
Joined: Tue Oct 12, 2021 12:49 pm

How to debug RPC requests?

Post by dredkin »

Hello!
I'm running a transmission-daemon on Ubuntu server 20.04 LTS
Now I'm trying to add some torrents through transmission's RPC requests.
The request returns 200/OK, but the torrent is not appearing in transmission!
I've tried to run transmission-daemon in console with --log-debug , but it shows NO RPC activity.
So my question is: how can I turn on RPC handling logging so I can trace down what am I doing wrong?
dredkin
Posts: 2
Joined: Tue Oct 12, 2021 12:49 pm

Re: How to debug RPC requests?

Post by dredkin »

JIC here are my logs:
DAEMON:

Code: Select all

debian-transmission@redkin-server:/home/dredkin$ /usr/bin/transmission-daemon --config-dir /var/lib/transmission-daemon/info -f --log-debug
[2021-10-12 16:19:35.464] Transmission 3.00 (bb6b5a062e) started (session.c:769)
[2021-10-12 16:19:35.464] Cache Maximum cache size set to 4.00 MiB (256 blocks) (cache.c:260)
[2021-10-12 16:19:35.464] RPC Server Adding address to whitelist: 127.0.0.1 (rpc-server.c:956)
[2021-10-12 16:19:35.464] RPC Server Adding address to whitelist: 192.168.72.* (rpc-server.c:956)
[2021-10-12 16:19:35.464] RPC Server Serving RPC and Web requests on 192.168.72.72:9091/transmission/ (rpc-server.c:1243)
[2021-10-12 16:19:35.464] RPC Server Started listening on 192.168.72.72:9091 (rpc-server.c:834)
[2021-10-12 16:19:35.464] RPC Server Password required (rpc-server.c:1254)
[2021-10-12 16:19:35.464] Bound socket 15 to port 51413 on 0.0.0.0 (net.c:462)
[2021-10-12 16:19:35.464] Bound socket 16 to port 51413 on ::1 (net.c:462)
[2021-10-12 16:19:35.464] Port Forwarding Stopped (port-forwarding.c:196)
[2021-10-12 16:19:35.464] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:97)
[2021-10-12 16:19:35.464] UDP Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf (tr-udp.c:99)
[2021-10-12 16:19:35.465] UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:105)
[2021-10-12 16:19:35.465] UDP Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf (tr-udp.c:107)
[2021-10-12 16:19:35.465] DHT Initializing DHT (tr-dht.c:338)
[2021-10-12 16:19:35.465] DHT Reusing old id (tr-dht.c:383)
[2021-10-12 16:19:35.465] DHT DHT initialized (tr-dht.c:413)
[2021-10-12 16:19:35.465] DHT Bootstrapping from 300 IPv4 nodes (tr-dht.c:172)
[2021-10-12 16:19:35.465] Using settings from "/var/lib/transmission-daemon/info" (daemon.c:646)
[2021-10-12 16:19:35.465] Saved "/etc/transmission-daemon/settings.json" (variant.c:1221)
[2021-10-12 16:19:35.465] transmission-daemon requiring authentication (daemon.c:674)
[2021-10-12 16:19:41.464] DHT Finished bootstrapping (tr-dht.c:317)
[2021-10-12 16:20:48.464] web will verify tracker certs using envvar CURL_CA_BUNDLE: none (web.c:455)
[2021-10-12 16:20:48.464] web NB: this only works if you built against libcurl with openssl or gnutls, NOT nss (web.c:457)
[2021-10-12 16:20:48.464] web NB: invalid certs will show up as 'Could not connect to tracker' like many other errors (web.c:458)
RPC client:

Code: Select all

TRANSMISSIONRPC_DEBUG:: GetSessionID():: Stream context created with options:
Array
(
    [http] => Array
        (
            [user_agent] => TransmissionRPC for PHP/0.3
            [ignore_errors] => 1
            [header] => Authorization: Basic dHJhbnNtaXNzaW9uOnRyYW5zZ3Vp

        )

)
TRANSMISSIONRPC_DEBUG:: GetSessionID():: Stream meta info:
Array
(
    [timed_out] =>
    [blocked] => 1
    [eof] =>
    [wrapper_data] => Array
        (
            [0] => HTTP/1.0 409 Conflict
            [1] => Server: Transmission
            [2] => X-Transmission-Session-Id: crmq83CegyOe7gL6PrHZNakvh0I4JP1rZJQkAzO3nKQ1IHM1
            [3] => Content-Type: text/html; charset=ISO-8859-1
            [4] => Connection: close
        )

    [wrapper_type] => http
    [stream_type] => tcp_socket/ssl
    [mode] => r
    [unread_bytes] => 581
    [seekable] =>
    [uri] => http://192.168.72.72:9091/transmission/rpc
)
TRANSMISSIONRPC_DEBUG:: GetSessionID():: Session-Id header:
X-Transmission-Session-Id: crmq83CegyOe7gL6PrHZNakvh0I4JP1rZJQkAzO3nKQ1IHM1TRANSMISSIONRPC_DEBUG:: request( method=session-stats, ...):: Stream context created with options:
Array
(
    [http] => Array
        (
            [user_agent] => TransmissionRPC for PHP/0.3
            [ignore_errors] => 1
            [method] => POST
            [header] => Content-type: application/json
X-Transmission-Session-Id: crmq83CegyOe7gL6PrHZNakvh0I4JP1rZJQkAzO3nKQ1IHM1
Authorization: Basic dHJhbnNtaXNzaW9uOnRyYW5zZ3Vp

            [content] => {"method":"session-stats","arguments":null}
        )

)
TRANSMISSIONRPC_DEBUG:: request( method=session-stats, ...):: POST Result:
{"arguments":{"activeTorrentCount":0,"cumulative-stats":{"downloadedBytes":1082456261820,"filesAdded":13413,"secondsActive":22168429,"sessionCount":27,"uploadedBytes":3103297004670},"current-stats":{"downloadedBytes":0,"filesAdded":0,"secondsActive":1281,"sessionCount":1,"uploadedBytes":0},"downloadSpeed":0,"pausedTorrentCount":0,"torrentCount":0,"uploadSpeed":0},"result":"success"}
TRANSMISSIONRPC_DEBUG:: request( method=session-stats, ...):: Stream meta info:
Array
(
    [timed_out] =>
    [blocked] => 1
    [eof] => 1
    [wrapper_data] => Array
        (
            [0] => HTTP/1.0 200 OK
            [1] => Server: Transmission
            [2] => Content-Type: application/json; charset=UTF-8
            [3] => Connection: close
        )

    [wrapper_type] => http
    [stream_type] => tcp_socket/ssl
    [mode] => r
    [unread_bytes] => 0
    [seekable] =>
    [uri] => http://192.168.72.72:9091/transmission/rpc
)
TRANSMISSIONRPC_DEBUG:: request( method=torrent-add, ...):: Stream context created with options:
Array
(
    [http] => Array
        (
            [user_agent] => TransmissionRPC for PHP/0.3
            [ignore_errors] => 1
            [method] => POST
            [header] => Content-type: application/json
X-Transmission-Session-Id: crmq83CegyOe7gL6PrHZNakvh0I4JP1rZJQkAzO3nKQ1IHM1
Authorization: Basic dHJhbnNtaXNzaW9uOnRyYW5zZ3Vp

            [content] => {"method":"torrent-add","arguments":{"download-dir":"\/mnt\/media\/\u0412\u0438\u0434\u0435\u043e\/\u0421\u0435\u0440\u0438\u0430\u043b\u044b\/","filename":"http:\/\/tormon.dredkin.ru\/torrents\/[example.com]_6065124.torrent"}}
        )

)
TRANSMISSIONRPC_DEBUG:: request( method=torrent-add, ...):: POST Result:
{"arguments":{},"result":"gotMetadataFromURL: http error 0: No Response"}
TRANSMISSIONRPC_DEBUG:: request( method=torrent-add, ...):: Stream meta info:
Array
(
    [timed_out] =>
    [blocked] => 1
    [eof] => 1
    [wrapper_data] => Array
        (
            [0] => HTTP/1.0 200 OK
            [1] => Server: Transmission
            [2] => Content-Type: application/json; charset=UTF-8
            [3] => Connection: close
        )

    [wrapper_type] => http
    [stream_type] => tcp_socket/ssl
    [mode] => r
    [unread_bytes] => 0
    [seekable] =>
    [uri] => http://192.168.72.72:9091/transmission/rpc
)
<br>
no_response<br>
killemov
Posts: 535
Joined: Sat Jul 31, 2010 5:04 pm

Re: How to debug RPC requests?

Post by killemov »

I see a lot of escaping in your torrent-add request. Maybe try a torrent on localhost first.
I could not get any server-side logging of RPC-requests either, but I could use the web-developer plugin for Firefox instead.
Post Reply