-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
javax.net.ssl.SSLException: SSLEngine closed already #1645
Comments
No, it creates a new SSLEngine for each connection.
|
Just tried. Same outcome.
I'll try to create isolated example tomorrow. But I'm pretty sure it will occur quickly if you call https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&id=30789216&cmd=neighbor_score&retmode=json couple thousand times. That's pretty much what my project does. SSL dies in couple minutes of pounding NCBI API. In the mean time could you please suggest workaround ? Why SSLEngine never recovers ? Can I forcibly re-initialize it right after I catch the exception? |
I was the one who put in that referenced issue #5860. A little TL:DR. I was connecting and having a mixed volume of traffic with SSL. I was creating a mutli connection session using two TCP connections. The first one connected and stayed with SSL. The other connection connected with SSL and shared handshake data to link the two connections to one session/user. I would then remove the SSL from the pipeline on both side simultaneously on the second connection which would cause the error as described in #5860. Have you tried with the most recent version of netty + listed in the #5860 commits that fixed the issue? On a side note. One way to have a temp solution is to wrap the error causing logic in a loop and just renew unusable resources (or erroting one) or statistics to your engine and find the values that your exceeding and make a manual or auto adjusting rate limiting engine? |
I suspect the problem has something to do with request retry. |
I'm afraid you'll have to provide a reproducer. I can't hammer your url because of your rate limiter. |
@slandelle Here we go It includes private API key (it's not my API btw) so rate limit is 10 calls / second. I guess how quickly it reproduces is pretty random. First time it took me only couple minutes to get the exception. Second attempt took me 7 mins to fail. In my production it takes ~30-50 mins to get to faulty state. I'm on Ubuntu MATE 19.04 $ java --version |
@unoexperto I think I've fixed it. Is there any chance you can build from sources and try on your side? |
@slandelle One test fails so I can't build it.
Is there maven command besides |
mvn package -Dmaven.test.skip |
7 days of running in production - no issues. Thanks! |
Great news, thanks for your feedback! |
Hi @slandelle. I've been haunted by this exception for couple years at least and after preliminary investigation I have feeling that AHC uses single
SSLEngine
for all instances ofDefaultAsyncHttpClient
class. Which means as soon as some bad domain botches it http clients of entire app stop working.Exception is thrown in
io.netty.handler.ssl.SslHandler.wrap(ChannelHandlerContext ctx, boolean inUnwrap)
in lineAnd the moment it happens it's pretty much game over for the client. All subsequent attempts to send request simply hang.
Could you please clarify how it works currently and what to do?
The text was updated successfully, but these errors were encountered: