-
Notifications
You must be signed in to change notification settings - Fork 123
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
MAKE P2P CONNECTION MORE RESILIENT #43
Comments
For my pool, I ended up modifying this to always reconnect -- with no retry limit. I didn't want to make the change here until I dug into it to identify why the nodes were getting disconnected so frequently. My guess is there is some sort of timeout that's being hit somewhere that needs to be addressed. |
This is NOT a timeout issue, or atleast i put THIS code:
Inside the reference: I still had the SAME issue:
As you can see If you can find a better solution than a retryCount -- i am all ears. |
Retry Count Log Here -- Maintains ALL P2P Connections.. yay!
I'm not making this up... this literally happens... look at the log. Now i know the implementation needs improvement cause it will stop maintaining connections after some LONG amount of time... the p2p connections come and go.. i guess peers go offline.... and the initial connections dont handshake the first time around for some reason... again I am using the latest ZEN release... TLS enabled, a secure node. the node tracker is HAPPY. My node must be setup correctly. I have successfully mined multiple blocks as well... |
I think a good middle ground could be to use you dont want to burden the system to try and do p2p connections for ever, maybe the magic value really is wrong... so the delay between retries and grow -- maybe the exponential strategy or linear stretegy... until eventually it stops retrying after a long while... this way you can avoid an extra config... if a successfull connection occurs the OR -- KEEP IT SIMPLE -- modify the existing retryCount to be 10 and on successful connection retryCount goes back to 10 i like this implementation the best
you follow? |
In my experience, some nodes (i.e. genx) don't accept p2p connections from the pool stratum at all. Most other nodes stay connected for a while but eventually disconnect. On my stratums, I just have them keep trying forever. With that being said, I've been running into some issues with one of my ZER nodes. It tends to get into a p2p reconnect loop that eats up a lot of cpu. I end up having to restart the node and stratum to get everything working again. I think the best solution is one where if disconnects are excessive, it adds a small delay to reconnecting -- but there is no limit. If you have p2p enabled in the config, it should always reconnect. |
#53 will fix the once running disconnect issues. PONG is always the proper response to PING; no PONG = disconnect after a time. |
FYI I updated my fork added:
based on the PR you provided still same issue -- does not fix issue |
I have a ZEN pool with the p2p enabled.
Always the first two or three p2p connection attempts fail:
34|pool_zen | 2019-06-01 21:36:57 [Pool] [horizen] (Thread 1) p2p had a socket error {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
To fix this issue and make the p2p connection more resilient i modified the
pool.js
as follows:As you can see I haved added a retry.
Now this implementation is obviously NOT perfect, BUT it proves to work.
Before i would have 0 p2p connections... maybe 1 in begining then they would all die..
With the code above i am able to maintain p2p connections
FYI my horizen daemon has TLS enabled
Please include some form of retry in your code as I have layed out.
Thanks
Cheers!
The text was updated successfully, but these errors were encountered: