SSL_read empty -> close?

Felipe Gasper felipe at felipegasper.com
Thu Nov 3 14:50:46 UTC 2022


> On Nov 3, 2022, at 10:17, Michael Wojcik via openssl-users <openssl-users at openssl.org> wrote:
> 
>> Does OpenSSL’s documentation mention that? (I’m not exhaustively
>> familiar with it, but I don’t remember having seen such.)
> 
> I doubt it. I don't see anything on the wiki, and this is a pretty obscure issue, all things considered.

You probably know this, but: On Linux, at least, if a TCP socket close()s with a non-empty read buffer, the kernel sends TCP RST to the peer. Some applications “panic” when they receive the RST and discard data. It’s a rare issue, but when it does it’s a head-scratcher. To avoid that, it’s necessary to shutdown(SHUT_RD) then drain the read buffer before close().

So it seems like this *shouldn’t* be obscure, if applications do the shutdown/drain thing. I would guess that many don’t and just don’t see the RST thing frequently enough to worry about it. Regardless, the documentation is already pretty voluminous, so if this doesn’t bite many folks, then hey.

Thank you!

-F


More information about the openssl-users mailing list