-
Notifications
You must be signed in to change notification settings - Fork 141
OpenSSL TLS provider not working correctly #304
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 s 8000 ervice and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which version of trantor or drogon did you use? |
My trantor lib is built from commit tree https://github.com/an-tao/trantor/tree/26a599857a2fa5d61823ef85012e3d9123d5a675 as of right now and drogon is built from tag 1.9.0 tree. I saw there were no relevant changes to the OpenSSL handling in either drogon or trantor since those tags |
Is it possible that the last chunk of data is not properly flushed to the TCP socket when the HTTP connection is closed? Maybe there are still some bytes pending and trantor does not wait until it is fully transferred to the client before closing the connection? |
I can't reproduce this error in my environment.
@marty1885 What do you think might be causing this issue? |
I had a similar issue once in an implementation of a TCP SSL socket using asio. Turned out I had to call asio::ssl_stream::shutdown before calling the socket close method. Maybe it could be something similar here? Where some bytes remain unsent on the socket until it is gracefully shut down (which would cause a flush)? |
Also happens with latest trantor (v1.5.15) and drogon (v1.9.1) |
Me too I can't replicate the issue what so ever. This is what is blocking me from fixing it. :( @tripleslash Can you share details about the environment you are using? OpenSSL version, compiler, distro, etc.. And if you have Botan3. Can you try Botan 3 and see if the same thing is happening? |
Custom built Linux BSP with Kernel 6.5.12 and OpenSSL 3.1.0. I cant change my TLS Provider because many other applications on my system depend on OpenSSL |
This is what happens when an incomplete file is transferred in the drogon.log with the highest log level. Maybe this can help you find the problem? |
Can you test your application in a normal linux x86 server? |
|
You could modify that line to output the error number. |
That is normal and expected. That sounds like the async socket is full and we are waiting for the OS to make the socket writable again. Hmm.... I agree this could solved by your proposal. But I really need to replicate the bug locally to fix it. @tripleslash You should be able to switch the TLS provider. Other code can keep using OpenSSL. Trantor will simply use Botan3 for the underlying. Unless you are setting OpenSSL specific configuration commands. |
errno = 11 = EAGAIN |
It is quite some effort to add a new BSP build rule to build a completely new TLS lib. Apart from that I really would like to use the same TLS implementation across the entire system |
The issue seems to happen more frequently when you try to connect to the device from outside the intranet or over SSH proxies for example. In intranet it is hard to reproduce I agree. Try to establish a connection from some remote network (maybe over your phone via LTE) and see if it happens for you. If not then try an ssh socks5 proxy. The File also needs to be quite large. 100 KB should be enough. |
@tripleslash I've looked into the issue but it's baffling me. Is it possible for me to get access to a system that can replicate the issue? Another weird thing that I noticed. The HTTP/1.1 response should not (and does not, according to the logs) cause the TCP connection to send. Thus not look like something got terminated early. Maybe this has something to do with threading...? |
What type of access are you looking for? I could forward a https Port but cannot give you SSH access to the device. If thats good enough for you to see the issue in action then you can add me on Discord under xerabtw |
@tripleslash Sorry getting back to you late. Can you try the latest master? We fixed a bug that may be related to this bug report. |
@marty1885 This issue still persists with the current master of trantor+drogon |
I think the PR may resolve this problem, @tripleslash would u please check it out? |
I can confirm that the issue seems to be gone with the refactored trantor API ! @an-tao |
another update on this: i was able to still reproduce this error but it seems to happen much more rarely now with the trantor refactoring |
@tripleslash Thanks so much for your test on this. I added some debug logs to the destructor of the Tcp Connection Impl class (6f85477). |
Uh oh!
There was an error while loading. Please reload this page.
When a HTTPs response with a large content body is sent, then not all bytes will be transferred and the connection will hang indefinitely until it reaches a timeout.
Example request:
Is it possible that the last chunk of data is not flushed to the output?
The text was updated successfully, but these errors were encountered: