tardis-dev / serum-vial

Real-time WebSocket market data API for Serum
Mozilla Public License 2.0
173 stars 60 forks source link

FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up #14

Closed khssnv closed 3 years ago

khssnv commented 3 years ago

Hello. An unexpected shutdown happened with an error shown below.

2021-05-03T15:28:37.614Z error: Minion worker 2 error occurred: failed to get info about account 2WghiBkDL2yRhHdvm8CpprrkmfguuQGJTCDfPSudKBAZ: FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up Error: failed to get info about account 2WghiBkDL2yRhHdvm8CpprrkmfguuQGJTCDfPSudKBAZ: FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up
    at Connection.getAccountInfo (/usr/local/lib/node_modules/serum-vial/node_modules/@solana/web3.js/lib/index.cjs.js:3535:13)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Function.load (/usr/local/lib/node_modules/serum-vial/node_modules/@project-serum/serum/lib/market.js:104:45)
    at async /usr/local/lib/node_modules/serum-vial/dist/minion.js:64:102
    at async Promise.all (index 48)
    at async Minion._listMarkets (/usr/local/lib/node_modules/serum-vial/dist/minion.js:62:33) 
Uncaught Exception thrown Error: failed to get info about account 2WghiBkDL2yRhHdvm8CpprrkmfguuQGJTCDfPSudKBAZ: FetchError: request to https://api.mainnet-beta.solana.com/ failed, reason: socket hang up
    at Connection.getAccountInfo (/usr/local/lib/node_modules/serum-vial/node_modules/@solana/web3.js/lib/index.cjs.js:3535:13)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Function.load (/usr/local/lib/node_modules/serum-vial/node_modules/@project-serum/serum/lib/market.js:104:45)
    at async /usr/local/lib/node_modules/serum-vial/dist/minion.js:64:102
    at async Promise.all (index 48)
    at async Minion._listMarkets (/usr/local/lib/node_modules/serum-vial/dist/minion.js:62:33)
uv loop at [0x7f1f47ffeb38] has open handles:
[0x7f1f3c1b3040] poll (active)
        Close callback: 0x91 
        Data: 0x7f1f3c38c800 
        (First field): 0x7f1f3c1b3040 
uv loop at [0x7f1f47ffeb38] has 1 open handles in total
node[7]: ../src/debug_utils.cc:322:void node::CheckedUvLoopClose(uv_loop_t*): Assertion `0 && "uv_loop_close() while having open handles"' failed.
 1: 0xa89e60 node::Abort() [node]
 2: 0xa89ede  [node]
 3: 0xa02ed1  [node]
 4: 0xb52980 node::worker::Worker::Run() [node]
 5: 0xb529c8  [node]
 6: 0x7f1f5fb524a4  [/lib/x86_64-linux-gnu/libpthread.so.0]
 7: 0x7f1f5f894d0f clone [/lib/x86_64-linux-gnu/libc.so.6]
Aborted
thaaddeus commented 3 years ago

Hi @khssnv thanks I've noticed that as well when using solana nodes which are rate limited now, what I found that is very stable is running your own RPC node locally and connect serum-vial to it. Meanwhile I'll try to find a way to catch this error and handle it gracefully, but not sure yet as it's in web3.js lib.

khssnv commented 3 years ago

So it is related to Sonala RPC rate limited, got it. Thanks!

thaaddeus commented 3 years ago

I've released a fix that should help with and retry on error in v1.0.4.