-
Notifications
You must be signed in to change notification settings - Fork 51
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
Unstable TLS connection #95
Comments
Thank you for opening this issue, @fgi. I can't reproduce this on my MacOS. I tired downloading a 480Kb file multiple times and they were all successful (using If you upgrade to OpenSSL 1.1.1g, does the issue persist (that's the version I'm running against)? Does this happen with a self-signed certificate? ( Sadly, I'm swamped and might no get to work on the issue for a while, but I'll do my best to speed things up as soon as I can reproduce the issue. Kindly, P.S. I tested using this Ruby script: def download_file
`curl --insecure https://localhost:3000/assets/logo/facil_logos_png.zip > tmp.zip`
end
while(true)
10.times { Thread.new() { download_file() } }
download_file()
sleep(0.1)
end I'm still looking. If I find something, I'll update this issue. |
I upgraded OpenSSL to 1.1.1g and tried with a self-signed certificate. Kindly, |
I'm still can't seem to debug the issue, as I can't recreate it (and I'm also bogged down with other work). The whole of the implementation concern for OpenSSL is in the Read-Write hooks coded in The requirements for these read-write hooks and the API is detailed in the I think the best approach would be to replace the OpenSSL socket API based implementation with an OpenSSL BIO API implementation (buffered IO). If anyone comes across this issue and can contribute, that would be great. Otherwise it might take longer than I like. B. |
I did more testing based on your Ruby script. I can't recreate the issue with a script using |
Thanks for the update. If this is a browser related issue, it might not have shown on my tests at all... does it occur with TLS disabled? Is it truly a TLS issue? It might be a pipelining issue 🤔 B. |
It does not occur without TLS. Pipelining? |
Good to know.
It's possible to send a large number of requests without waiting for a response. This is called pipelining. When facil.io / iodine detect a pipelining client (single connection), they will reschedule the client after a few requests to prevent a DOS attack (allowing other client to perform work). Unlike a slow client attack, where the throttling is reported to the debug log, pipelining might be a valid client and isn't reported (I should probably change that). I thought maybe an error occurred somewhere around that point. That was assuming that when you quickly refresh the page a number of times, the browser's network layer might collect a larger number of requests into its buffer, pipelining all these requests (sending them through the same connection without waiting for a response). |
Thank you for the explanation about pipelining. Finally, I could recreate the issue with curl and reduced it to a minimalistic configuration.
You can run following curl command 4-5 times to observe interrupted transfers:
I added a symbolic link to Iodine log file in
Strangely, when I launch this curl request in a terminal directly on the server, the issue does not occur. I hope it helps. |
Hello @boazsegev,
Here is an issue related to TLS connections, I suppose lost or reset state while in use.
System Information
Description
I launch Iodine with following command in a FreeBSD service (run as root):
$GEMDIR/iodine -b X.X.X.X -p 443 -w 1 -tls-cert $CERTDIR/cert.pem -tls-key $CERTDIR/privkey.pem -public $DIR/public -v 2>$DIR/log/iodine.log -verbosity 5 &
Observed behaviors explained here could not be reproduced in HTTP, without TLS.
Behavior with static files
Static path is set at Iodine launch, Ruby should not be involved in static files delivery.
On some static file requests, the TLS connection fails to finish sending data and the process overloads CPU. The connection seems to stop working and is closed with a TLS cleanup after about 1min 37sec.
Example:
First try to load
2.32db9452.chunk.js
file, all seems to be okay.A couple more reloads work as well.
One more time,
2.32db9452.chunk.js
file delivery is stopped with about one half of data sent, the process overloads the CPU at 100% for about 25-30 seconds:The log says that the file is delivered but it's incomplete.
The browser waits for the end of the file.
After 1 min and 37 sec, the connection seems to be reinitialized or closed:
The browser stops waiting, shows a HTTP code 200 but received file is not complete.
It seems to occur on files bigger than 100-150kb maybe. The one in the example is 200kb.
I could not reproduce it with smaller files, but I could with larger ones, like images.
Behavior with Websockets
I observed something similar with websockets, so I add it to this issue.
I open a websocket, exchange a small amount of data and suddenly or after about 15 minutes, the process starts running 100% of the CPU forever.
The previously opened websocket does not seem to respond.
It's hard to say what is going on in the websocket. I activated Ruby logs in all events but they show no error.
There is nothing in Iodine logs, the server is not crashed but is very slow until I restart it.
I hope this information is enough to analyse the issue.
Don't hesitate to ask if I can help.
Kindly,
Franck
The text was updated successfully, but these errors were encountered: