#668·upspin

Stress testing yields TLS handshake errors and improper closing of files?

Author: BHare1985Created Jul 28, 2024Updated Jul 29, 2024

What version of Upspin are you using?

upspin -version reports "devel" but I did go install a few days ago, so doesn't include the latest PR (667).

What operating system and processor architecture are you using?

Ubuntu 22.04.3 LTS. AMD64

What did you do?

Upload and download 1000 files, repeated many times

What did you expect to see?

No errors, or maybe a few TLS i/o timeouts randomly within reason

What did you see instead?

more than a few TLS errors, more concerning is that eventually hit "too many open files"


I am not 100% sure where the problem lies, but only what I've done to reproduce it.

Effectively I am stress testing upspin by running some batch scripts which uploads 1,000 files and then downloads 1,000 files.

generate.sh -> generate a file with random 100 bytes (file.orig) and then split into 10 files with 10 bytes each named file.0 ... file.9.

upload.sh -> I then create a upspin directory based on the sha256 of file.orig and upload the 10 files.

download.sh -> I then download the 10 files and name them download.0 ... download.9 and then combine them back to download.orig and ensure its the same as the file.org

You can see all these scripts and run them for yourself. https://gist.github.com/BHare1985/1a7b0950a36f388061257a3fe0dbfdb4

I then run each step 100 times asynchronously with

for ((i=1; i<=100; i++)); do ~/generate.sh "$i" & done;
#wait for it to complete

for ((i=1; i<=100; i++)); do ~/upload.sh "$i" & done;
#wait for it to complete

for ((i=1; i<=100; i++)); do ~/download.sh "$i" & done;

When upload.sh runs it's always uploading 100 files at any given moment. This seems seems to block each other and causes uploading of 10 files to take ~10 seconds to complete. That is, uploading 1,000 files takes ~15 seconds in total, but each batch of 10 seems to all complete around the same time, with each script reporting ~10 seconds run time on my PC. (DirServer and StoreServer are both local to the client running the commands). Downloading is basically the same.

If I run just once instance of each, e.g. ~/generate.sh; ~/upload.sh; ~/download.sh then uploading and downloading of the 10 files both takes only 1-2 seconds each. I am surprised that running things asynchronously results in batches taking much longer.

While it seems asynchronous uploading and downloading does seem to suffer from some sort of blocking and I fully expected the upload and download of 10 byte files to be way faster, but I understand upspin motto:

"Performance is not a primary goal. Uniformity and security are."


This is all just a setup to the actual problem I am concerned about;

My issue is that running these tests I start getting http: TLS handshake error from 172.18.176.1:56134: EOFs and TLS handshake error from 172.18.176.1:56263: read tcp 172.18.180.226:443->172.18.176.1:56263: i/o timeout in my server logs. For the 1000 requests, I would get maybe 20 of these errors.

More concerning is that deleting the files locally (not on upspin) and re-testing, over 10 minutes of repeating many times I eventually get http: Accept error: accept tcp [::]:443: accept4: too many open files; retrying in 10ms errors. While I haven't tweaked linux to have a higher limit than default, I would not expect upspin to be suffering from this if it was properly closing files.