tardis-dev / serum-vial

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

ECONNREFUSED error, while running the docker container #21

Closed ntegrals closed 3 years ago

ntegrals commented 3 years ago

I am currently getting a connection refused error when running serum-vial connected to my local validator after approx. 1 min. (So serum-vial fetches data for 1 min and then errors with the message below.)

I assume it's more related to the node itself (might be wrong though), nevertheless I don't really see why this behaviour occurred. So any pointers would be appreciated.

Error log below:

2021-06-03T14:47:14.463Z error: Serum producer worker 2 error occurred: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899 undefined Uncaught Exception thrown Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({ message: 'request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899', type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED' })

thaaddeus commented 3 years ago

not sure, is your RPC node stable and responds fine to REST API requests? looks like some kind of connection error to it.

ntegrals commented 3 years ago

Well, I would say so.

Running with npx (instead of Docker) gives me loads of errors likes this. Any idea why this happens?

Btw: My server specs are: 128gb RAM, 3,5tb NVMe SSD, 16 cores, Ryzen Threadripper. Is this good enough to run serum-vial?

2021-06-04T16:43:16.758Z info: Received RPC WebSocket close, reason: , code: 1006 {"market":"CREAM/USDT"} 2021-06-04T16:43:16.758Z info: Restarting RPC WebSocket connection... {"market":"CREAM/USDT","delayMs":1600} 2021-06-04T16:43:16.807Z info: Received RPC WebSocket error, error message: Unexpected server response: 405 {"market":"COPE/USDC"} 2021-06-04T16:43:16.807Z info: Received RPC WebSocket close, reason: , code: 1006 {"market":"COPE/USDC"} 2021-06-04T16:43:16.807Z info: Restarting RPC WebSocket connection... {"market":"COPE/USDC","delayMs":1850} 2021-06-04T16:43:16.820Z info: Received RPC WebSocket error, error message: Unexpected server response: 405 {"market":"HGET/USDT"} 2021-06-04T16:43:16.820Z info: Received RPC WebSocket close, reason: , code: 1006 {"market":"HGET/USDT"} 2021-06-04T16:43:16.821Z info: Restarting RPC WebSocket connection... {"market":"HGET/USDT","delayMs":2200}

thaaddeus commented 3 years ago

Serum-vial is not that resource intensive, running Solana RPC node is, but I'd say your spec if fine. It looks like serum-vial can't connect to your Solana node, does it have RPC enabled? can you query it via other options (like via serum lib directly)?

ntegrals commented 3 years ago

Great to hear that!

Serum lib works fine.

So it seems like it's something related to serum-vial.

thaaddeus commented 3 years ago

Can you share cli flags how your run Solana RPC node, especially RPC ports? and serum-vial flags?

ntegrals commented 3 years ago

Sure!

RPC Flags: solana-validator \ --identity ~/validator-keypair.json \ --gossip-port 8001 \ --rpc-port 8899 \ --dynamic-port-range 8002-8012 \ --entrypoint entrypoint.devnet.solana.com:8001 \ --entrypoint entrypoint2.mainnet-beta.solana.com:8001 \ --entrypoint entrypoint3.mainnet-beta.solana.com:8001 \ --entrypoint entrypoint4.mainnet-beta.solana.com:8001 \ --entrypoint entrypoint5.mainnet-beta.solana.com:8001 \ --private-rpc \ --no-voting \ --limit-ledger-size \ --log -

Servum-Vial Flags: npx serum-vial --endpoint http://localhost:8899 --log-level debug --port 6000

thaaddeus commented 3 years ago

Can you try adding --ws-endpoint-port 8900 flag to serum-vial? By default Solana RPC node provides WebSocket API on different port than HTTP API (which is on 8899) see https://docs.solana.com/developing/clients/jsonrpc-api.

thaaddeus commented 3 years ago

I'm closing it unless you still have issues with it.