-
Notifications
You must be signed in to change notification settings - Fork 114
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
EPS does not notice when a connection is dead (IOError) #259
Comments
Thanks for the detailed issue. Probably the best way to solve this is to have the server ping the client, there is a protocol method for pinging: https://github.com/spesmilo/electrumx/blob/master/docs/protocol-methods.rst#serverping There is already a place in the code to add such a ping: electrum-personal-server/electrumpersonalserver/server/common.py Lines 198 to 207 in 6909e76
If not sending a ping, those docs say that servers can disconnect clients after a timeout. Just so everyone knows, unfortunately this issue cant be a priority for me for the next year or so. If someone else codes it I can help review though. |
@chris-belcher Thank you for your answer. Isn't there an easier way to set the 25 minute timeout further down? Of course, implementing the ping method is the best method in the long-term. |
You're right, there might be. The TCP socket option called keepalive might do the the trick https://www.programcreek.com/python/example/4925/socket.SO_KEEPALIVE But if you're talking about the socket.settimeout() method which is invoked a couple of times near that code, that wont be it. That kind of timeout just means the interval at which the socket stops waiting for stuff to happen and instead sends control flow somewhere else. In EPS this feature is used to query the bitcoin core node for information about new transactions, new blocks or the state of the mempool. |
I realize that the protocol method I linked only works from the client to the server, not from the server to the client. I tried making a hanging connection to public electrum servers out there, I just made a connection and didn't send anything. The servers don't send any kind of ping and leave the connection open for a long time (I gave up wait after about 30 minutes). So this issue doesn't have an easy fix. The fundamental problem comes from only supporting one connection at a time, so it will be fixed when issue #50 is implemented. |
Steps to reproduce:
openssl s_client -connect epsserver:50002
The timeout of the socket came only after 25 minutes
DEBUG: 16:16: IOError: TimeoutError(110, 'Connection timed out')
Workaround:
systemctl restart electrumpersonalserver
I think something with the connection management is not running ideally.
My wish is, that as long as EPS can only handle one connection, the timeout should be very short.
electrum-personal-server/electrumpersonalserver/server/common.py
Line 160 in cb6f76b
versions: eps 0.2.1.1
The text was updated successfully, but these errors were encountered: