Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update network connectivity on selection, and detect if the network becomes reachable/not #44

Merged

Conversation

SvenDowideit
Copy link
Member

@SvenDowideit SvenDowideit commented Mar 15, 2022

changing networks between working and not-working didn't change the validator.running state, so things didn't match up

it still doesn't notice a state change in the selected network, but at least switching networks means it gets updates,

  • detect currently selected network state change, and show it
  • make the state ternery - add an unknown - that you get until the first validator state message is returned.

@SvenDowideit
Copy link
Member Author

SvenDowideit commented Mar 15, 2022

The real reason i started looking, is that if you have a local validator, and stop it, after that, the unsubscribeprogramchanges fails hard, and from that point, the web3.js code keeps trying ws error: connect ECONNREFUSED 127.0.0.1:8900

which makes me suspect that if we have intermittent network, we're going to notice the resource leak.

2022-03-15T03:54:09.971Z INFO connection failed                                 
2022-03-15T03:54:09.972Z INFO OK                                                method=validator-state running=false
2022-03-15T03:54:09.972Z ERROR ERROR                                             method=accounts name=FetchError
2022-03-15T03:54:09.972Z ERROR Stacktrace:                                       
2022-03-15T03:54:09.972Z ERROR  FetchError: request to http://127.0.0.1:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899
2022-03-15T03:54:09.972Z ERROR      at ClientRequest.<anonymous> (/home/sven/src/cryptoworkbench/solana-workbench/release/app/node_modules/node-fetch/lib/index.js:1491:11)
2022-03-15T03:54:09.972Z ERROR      at ClientRequest.emit (node:events:394:28)   
2022-03-15T03:54:09.972Z ERROR      at ClientRequest.emit (node:domain:470:12)   
2022-03-15T03:54:09.972Z ERROR      at Socket.socketErrorListener (node:_http_client:447:9)
2022-03-15T03:54:09.972Z ERROR      at Socket.emit (node:events:394:28)          
2022-03-15T03:54:09.972Z ERROR      at Socket.emit (node:domain:470:12)          
2022-03-15T03:54:09.972Z ERROR      at emitErrorNT (node:internal/streams/destroy:157:8)
2022-03-15T03:54:09.972Z ERROR      at emitErrorCloseNT (node:internal/streams/destroy:122:3)
2022-03-15T03:54:09.972Z ERROR      at processTicksAndRejections (node:internal/process/task_queues:83:21)
2022-03-15T03:54:10.282Z INFO OK                                                method=unsubscribe-program-changes

this will be dealt with in a different PR - possibly in solana-web3.js?

@SvenDowideit SvenDowideit changed the title [WIP] initial investigation into network availabliity info Update network connectivity on selection, and detect if the network becomes reachable/not Mar 15, 2022
@nathanleclaire
Copy link
Contributor

nathanleclaire commented Mar 15, 2022

Nice, I really like the change in validator state to enum.

Before we double down on program changes, I think we should do some thinking on if it's the right approach. Lately, for instance, I've been wondering why maybe we don't just work our way through the slots (blocks) and store the relevant info in the DB (which programs/accounts are of interest, etc). Then we wouldn't necessarily have this whole fragile subscription model going.

@SvenDowideit SvenDowideit force-pushed the update-network-availability-for-all-validator-networks branch from d3e38b9 to f29e4d0 Compare March 15, 2022 22:28
@SvenDowideit
Copy link
Member Author

@nathanleclaire yup, but that's totally for a different PR/issue :)

src/renderer/App.tsx Outdated Show resolved Hide resolved
src/main/validator.ts Outdated Show resolved Hide resolved
src/renderer/nav/Accounts.tsx Show resolved Hide resolved
src/renderer/App.tsx Outdated Show resolved Hide resolved
@SvenDowideit SvenDowideit force-pushed the update-network-availability-for-all-validator-networks branch from f29e4d0 to bc471f1 Compare March 15, 2022 23:34
@nathanleclaire
Copy link
Contributor

LGTM

@nathanleclaire nathanleclaire merged commit 0a08b4b into main Mar 16, 2022
@nathanleclaire nathanleclaire deleted the update-network-availability-for-all-validator-networks branch March 16, 2022 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants