blockworks-foundation / liquidator-v3

Mango Markets V3 Liquidator Bot
MIT License
308 stars 111 forks source link

Keep getting Error reloading accounts: FetchError: request to rpc failed, reason: socket hang up, for all subsequent refreshAccounts method call #28

Open anishsamant opened 2 years ago

anishsamant commented 2 years ago

The code successfully fetches the mango accounts in the initial refreshAccounts call, but for all subsequent calls it gives Error reloading accounts: FetchError: request to rpc failed, reason: socket hang up.

Screenshot 2022-07-18 113744

riordanp commented 2 years ago

Hi @anishsamant, this sounds like an issue with your RPC provider. Please check you are not being rate limited or similar

samlaf commented 2 years ago

Were you using the solana endpoint (https://api.devnet.solana.com) instead of mango endpoint (https://mango.rpcpool.com/946ef7337da3f5b8d3e4a34e7f88) by any chance @anishsamant ?

I'm observing similar behavior when using the solana public endpoint. First getting

Error: Error reloading accounts: FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up
    at /Users/samlaf/devel/solana/mangomarkets/liquidator-v3/scripts/mangoAccounts.ts:37:15
    at Generator.throw (<anonymous>)
    at rejected (/Users/samlaf/devel/solana/mangomarkets/liquidator-v3/scripts/mangoAccounts.ts:6:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

and when I retry I get

Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
......... (~ 100 times) ........... (and then)
/Users/samlaf/devel/solana/mangomarkets/liquidator-v3/scripts/mangoAccounts.ts:6
    try {
                                                                ^
Error: Error reloading accounts: FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: connect ECONNREFUSED 147.75.42.181:443
    at /Users/samlaf/devel/solana/mangomarkets/liquidator-v3/scripts/mangoAccounts.ts:37:15
    at Generator.throw (<anonymous>)
    at rejected (/Users/samlaf/devel/solana/mangomarkets/liquidator-v3/scripts/mangoAccounts.ts:6:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)