XRPLF / clio

An XRP Ledger API Server
https://xrpl.org
ISC License
55 stars 47 forks source link

ripple_path_find response of clio is inconsistent and failing with an error. #1480

Closed mounikakun closed 3 days ago

mounikakun commented 1 week ago

Issue Description

ripple_path_find is failing due to an error failedToForward and suggested fix was to increase forwarding request_timeout in clio config. With suggested fix the response is inconsistent.

"forwarding": {
        "request_timeout": 10.0 // time for Clio to wait for rippled to reply on a forwarded request (default is 10 seconds)
    },

Steps to Reproduce

Sample request:

{"method": "ripple_path_find", "params": [{"destination_account": "r3SUNTrUmUe9Ce1WfcuXNS8M1HuPaTwqSf", "destination_amount": {"currency": "USD", "issuer": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7", "value": "10000"}, "source_account": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7", "source_currencies": [{"currency": "XRP"}, {"currency": "USD"}], "ledger_index": "validated", "Fee": "20"}]}

Expected Result

Below response is expected at all times.

{
    "result": {
        "alternatives": [
            {
                "paths_canonical": [],
                "paths_computed": [],
                "source_amount": {
                    "currency": "USD",
                    "issuer": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7",
                    "value": "10000"
                }
            }
        ],
        "destination_account": "r3SUNTrUmUe9Ce1WfcuXNS8M1HuPaTwqSf",
        "destination_amount": {
            "currency": "USD",
            "issuer": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7",
            "value": "10000"
        },
        "destination_currencies": [
            "USD",
            "XRP"
        ],
        "full_reply": true,
        "ledger_hash": "125AD0A50FF30A3C60AC48D6AFD81E0B653B3EB9FA966AB750055C0D88DE963C",
        "ledger_index": 1734424,
        "source_account": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7",
        "validated": true,
        "status": "success"
    },
    "status": "success",
    "type": "response",
    "forwarded": true,
    "warnings": [
        {
            "id": 2001,
            "message": "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
        }
    ]
}

Actual Result

Sometimes there's a successful response but not always. Adding a sample of errored response.

clio response:

{
    "result": {
        "error": "failedToForward",
        "error_code": 90,
        "error_message": "Failed to forward request to p2p node",
        "status": "error",
        "type": "response",
        "request": {
            "method": "ripple_path_find",
            "params": [
                {
                    "destination_account": "r3SUNTrUmUe9Ce1WfcuXNS8M1HuPaTwqSf",
                    "destination_amount": {
                        "currency": "USD",
                        "issuer": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7",
                        "value": "10000"
                    },
                    "source_account": "racF89eVwgU5XcAjJhS1z4VXpCPZCxN9Q7",
                    "source_currencies": [
                        {
                            "currency": "XRP"
                        },
                        {
                            "currency": "USD"
                        }
                    ],
                    "ledger_index": "validated",
                    "Fee": "20"
                }
            ]
        }
    },
    "warnings": [
        {
            "id": 2001,
            "message": "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
        }
    ]
}

Environment

ubuntu:22.04 clio_version: 20240618101106-develop-0cdc240'

Supporting Files

kuznetsss commented 1 week ago

I was doing the request you provided in a loop for 15 minutes and never saw forwarding error. For me rippled can process the request in 8 seconds, so default forwarding timeout 10 seconds is enough in my case. Probably for you rippled is being slow because of some other requests.

mounikakun commented 1 week ago

All the clio pipelines passed with 15s forwarding time out. Test suites run in parallel so there will be more than an request at time on rippled that might be causing the delay in response.

mounikakun commented 1 week ago

ripple_path_find failed even with 15s on rippled tests pipeline which runs on clio server. Rippled test suites count is more compared to clio test suite count as these test suites run in parallel there will be more load on rippled while running rippled tests on clio server than clio tests on clio server.

kuznetsss commented 3 days ago

Rippled is being slow. We checked that there is no issue in Clio with forwarding.