KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
104 stars 94 forks source link

excessive resource usage on electrums when tx_history is on #1221

Closed cipig closed 2 years ago

cipig commented 2 years ago

on ADEX Desktop using mm2 from dev branch i get this errors every 10s and LYNX is not working:

· 2022-03-05 23:12:42 +0000 [tx_history coin=LYNX] utxo_common:1898] Error MmError { etype: Transport("JsonRpcError { client_info: \"coin: LYNX\", request: JsonRpcRequest { jsonrpc: \"2.0\", id: \"22198\", method: \"blockchain.scripthash.get_balance\", params: [String(\"341adf3e07f9ae45ba9d3898ab43dd7399729e28a12f09dbf7098cfa182dc764\")] }, error: Transport(\"rpc_clients:1425] All electrums are currently disconnected\") }"), trace: [TraceLocation { file: "utxo_common", line: 269 }] } on getting balance
· 2022-03-05 23:12:42 +0000 [tx_history coin=LYNX] utxo_common:1923] utxo_common:2135] Error rpc_clients:1425] All electrums are currently disconnected on scripthash_get_history, retrying

mm2 on CLI (no GUI) doesn't have this problem, so i assume it is related to tx_history (which is off on CLI)

EDIT: looked into entire log and discovered this

05 08:06:47, coins:rpc_clients:2143] INFO electrum.logware.club:50002 connection dropped
05 08:06:47, utxo_coin_builder:689] Electrum electrum.logware.club:50002 server.version error "JsonRpcError { client_info: "coin: LYNX", request: JsonRpcRequest { jsonrpc: "2.0", id: "2351", method: "server.version", params: [String("AtomicDex Desktop 0.5.4-beta GUI/MM2 2.1.5525_dev_db95a0e34_Linux_Release"), Array([String("1.2"), String("1.4")])] }, error: Response(electrum.logware.club:50002, Object({"code": Number(-101), "message": String("excessive resource usage")})) }".

being the first error related to LYNX electrums... seems the servers are simply reaching the resource limit because of tx_history and then deny the client from reconnecting. Will ask the guy running the servers to disable ressource limits, but i think we should find a better solution to not reach this limits. Can we disable tx_history altogether? Or make it slower?

getlynx commented 2 years ago

Build script updated... https://github.com/getlynx/LynxElectrumBuilder/blob/main/build.sh

artemii235 commented 2 years ago

We need the blockchain.scripthash.get_history to support pagination. Also, if the error happens only with LYNX, then it's more of a specific electrums' problem.

cipig commented 2 years ago

I hope the upcoming electrumx protocol update will support pagination on get_history.

Checked again and excessive resource usage is not an error coming from electrumx itself (couldn't find the string in electrumx code), so it is coming from lynxd... and that doesn't surprise me at all because i remember that lynxd was causing much higher load then other coin daemons. Closing the issue for now.