The handshake operation timed out (poloniex)
Hello I am using this bot with poloniex (I am on the latest version via git pull). I am getting this ssl handshake error with various requests and it appears that the bot is not working properly. Is this a backend issue or a bot issue? BTW: I also used the search for "The handshake operation timed out" before posting this issue. If there is any code that needs to be written, I'm pretty good with JS.
2017-10-12 10:46:35 Error <urlopen error ('_ssl.c:574: The handshake operation timed out',)> Requesting returnActiveLoans
2017-10-12 10:43:52 Error <urlopen error ('_ssl.c:574: The handshake operation timed out',)> Requesting returnLoanOrders
2017-10-12 10:41:10 Error <urlopen error ('_ssl.c:574: The handshake operation timed out',)> Requesting returnTicker
Hey David. It's all python. This error typically indicates issues between you and the exchange. Make sure you can resolve api.poloniex.com and that you don't have any proxy's in between. Also make sure your SSL certificates are up to date. You can test like this:
$ openssl s_client -connect api.poloniex.com:443
daxxog$ openssl s_client -connect api.poloniex.com:443
here is the output of the openssl command you posted:
CONNECTED(00000003)
depth=1 C = BE, O = GlobalSign nv-sa, CN = AlphaSSL CA - SHA256 - G2
verify error:num=20:unable to get local issuer certificate
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=*.poloniex.com
i:/C=BE/O=GlobalSign nv-sa/CN=AlphaSSL CA - SHA256 - G2
1 s:/C=BE/O=GlobalSign nv-sa/CN=AlphaSSL CA - SHA256 - G2
i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIE1DCCA7ygAwIBAgISESFfq81vFEmL6UBYWDM4pSNXMA0GCSqGSIb3DQEBCwUA
MEwxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSIwIAYD
VQQDExlBbHBoYVNTTCBDQSAtIFNIQTI1NiAtIEcyMB4XDTE1MTIwNDE5NTA0OVoX
DTE4MTIwNDE5NTA0OVowPDEhMB8GA1UECxMYRG9tYWluIENvbnRyb2wgVmFsaWRh
dGVkMRcwFQYDVQQDDA4qLnBvbG9uaWV4LmNvbTCCASIwDQY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PDIB/RQG5+xIXRfbGipomR0dbetgaBv3xCW5DGLp+0jr6S4+URMmTh0zIX
eqczV045unR7VKeyrADb+/6cXfSa88606YIvbPML2iIRQklff/7TNCjLedIL4IWz
33hNO5JIqje4lnKPVSKzYpcooUTGuCSih68o7uoCakmPVqvzL9rfjAAwpnHBMsxZ
xOMak5h2cmJ+/9wLod9ijg85mBy23RL94/JCwWqIOUHjV4ElWVjnBQWy0X+fdGs6
9O69LUxkGe2jcnZIA92wLh1vDj1KeTAx3VXbJawaHoCNJ/nxzxmKLg==
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/CN=*.poloniex.com
issuer=/C=BE/O=GlobalSign nv-sa/CN=AlphaSSL CA - SHA256 - G2
---
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 3016 bytes and written 474 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES128-GCM-SHA256
Session-ID: 39CB1F7F9E1D01983F6652AD09B7B381BEA712DAB5DD04478A14DEC7AD577617
Session-ID-ctx:
Master-Key: 83370921C6FA4274112B3987B48CDD1459F3162B30261305FF06B00773CEAD7F20C2451709FED1A89CD54F73802A8773
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 64800 (seconds)
TLS session ticket:
0000 - 35 13 90 ac 2a 0c 20 0b-ee 66 57 30 0b ee 90 c0 5...*. ..fW0....
0010 - cc d5 db bc 4c 37 63 a5-83 17 fb c1 7a 85 6c 5d ....L7c.....z.l]
0020 - bd e4 d4 41 c5 15 03 5a-13 89 a7 96 54 14 42 38 ...A...Z....T.B8
0030 - 9e 07 ef 54 c2 c9 3b e1-68 03 88 f4 b0 ac 98 1a ...T..;.h.......
0040 - cc d6 2a e3 2f 2b 8a f2-c7 47 d5 f9 5b b9 42 65 ..*./+...G..[.Be
0050 - 9c fa 4d 51 b3 f2 77 6e-60 8a aa 62 81 b0 81 48 ..MQ..wn`..b...H
0060 - 98 78 f6 c1 0b b1 b6 36-e2 6c d2 83 fd 65 dc 43 .x.....6.l...e.C
0070 - d7 60 19 bf c3 cd 35 1f-9d da d1 5e fc f2 66 2a .`....5....^..f*
0080 - 13 41 b8 73 67 85 0a d4-c8 9e dc 18 19 10 7a 5b .A.sg.........z[
0090 - ef b8 f4 92 4d 26 40 7f-6c f3 37 68 dc ee cf 08 ....M&@.l.7h....
00a0 - d6 9b 6b a0 92 0b 02 b5-2b c6 33 6e e0 2a d7 57 ..k.....+.3n.*.W
Start Time: 1507827636
Timeout : 300 (sec)
Verify return code: 20 (unable to get local issuer certificate)
---
closed
Mine says almost the same thing. Biggest concern is at the bottom where my verify return code is OK. Can you try from another system? Have you updated ca-certs package recently?
SSL handshake has read 2517 bytes and written 456 bytes
---
New, TLSv1/SSLv3, Cipher is AES128-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : AES128-SHA
Session-ID: F72F1862AFE531B5137C51FFD6CA5686F2B91F5E7C8D9F236944E7CEF90A03D8
Session-ID-ctx:
Master-Key: 27043880A875554933850123BBE286FF7970A651D0B46459E4BEEBF9FAABB3042ADD5797524ADB1091F6B07ED4A17AB3
Key-Arg : None
Start Time: 1507830500
Timeout : 300 (sec)
Verify return code: 0 (ok)
I tried from my linux box and I got the 0 (ok) code. How would I update my ca-certs package on MacOS?
NOTE: I am still getting 'The handshake operation timed out' when running from my linux box.
Oh, this is on mac? I'm on mac too, 10.12.6 and I'm not getting any issues. This is odd but not an issue with the bot itself.
Yes, on my mac I get the "Verify return code: 20 (unable to get local issuer certificate)" with openssl, and on linux I get "Verify return code: 0 (ok)". Both systems get 'The handshake operation timed out' when running the python script.

Do you have proxy or VPN running perhaps? My mac, ReadyNAS, and CentOS 7 VPS all showing 'Verify return code: 0 (ok)' None of them giving me handshake issues when running bot. Since this is all Python, make sure your python is all up to date. I'm on 2.7.9 on ReadyNAS (which runs my bots) 2.7.13 on mac.
Python 2.7.12 is installed on linux machine. This machine is running my bots and is using latest commit from repo. This machine says 'The handshake operation timed out' most of the time, but periodically is able to function for brief periods of time. Verify return code: 0 (ok) is returned from openssl.
Python 2.7.9 is installed on my MacBook Pro. This machine doesn't run my bots, but I have a copy of lending bot on here with latest commit from repo. This machine currently says '<urlopen error [Errno 60] Operation timed out'. Verify return code: 20 (unable to get local issuer certificate) is returned from openssl.
No VPN/PROXY is part of my network setup, all machines connect (somewhat) directly to the internet via LAN NAT routing.
Well, if it only happens periodically, this is probably an ISP/connectivity issue much like DNS failures or straight up timeouts. I get the timeouts frequently during busy exchange periods.
The bot is only able to function properly periodically, most of the time it is receiving timeouts. I using the fastest cable service in my area, all other websites work fine 24/7. If this is an issue with poloniex, I guess I should contact their support. If this an issue with the bot, I would like to help fix it.
Well, from personal experience, you won't ever get a response from their support. I've got 3 tickets over 5 months old with no activity since submitting. You aren't the only one getting timeouts. I get them too; but the bot handles them just fine and continues on working when there is a response. As another personal note, Poloniex's lending rates are sh*t these days with very low volume. I'm considering pulling out of Polo alltogether and concentrate on Bitfinex. However, this is a dangerous proposition since Bitfinex has announced they are stopping all US-based operations in November. As long as you haven't submitted personal info to them (I have not), you may be fine. You just can't lend USDT.
Thanks.
Hi,
I have the same error :
Error during new loans notification: <urlopen error ('_ssl.c:645: The handshake operation timed out',)> Requesting returnActiveLoans
But the test from openssl work fine :
Start Time: 1530470211
Timeout : 300 (sec)
Verify return code: 0 (ok)
WTF ?