Tarsnap / spiped

Spiped is a utility for creating symmetrically encrypted and authenticated pipes between socket addresses.
http://www.tarsnap.com/spiped.html
Other
858 stars 56 forks source link

Fixes #398

Closed gperciva closed 8 months ago

gperciva commented 9 months ago

Two embarrassing mistakes here; the one in dispatch_shutdown() is particularly bad.

These were uncovered during the investigation into #397, but they don't resolve whatever is happening in that issue. (I can reproduce the problem, but I'm still trying to figure out exactly what's happening there.)

gperciva commented 9 months ago

Added a third fix (not as embarrassing).

References (but nothing looks relevant):

More importantly, we discussed shutdown() receiving an ENOTCONN back in https://github.com/Tarsnap/spiped/pull/350; the final opinion was:

Ok, I think this is ok; it looks to me like ENOTCONN should not (non-erroneously) happen here, even if we get RST.

If users start reporting ENOTCONN then we should probably treat it as a non-error.

We now have a report of ENOTCONN in #397 (although the cause was disguised by the problem in dispatch_shutdown()), so this PR makes it a non-error.

(I can reproduce the ENOTCONN using postgresql; or with our test suite if I add a few sleep(1) to our code. I haven't yet been able to reproduce ENOTCONN with test programs without modifying spiped code, but I think it's sufficiently clear what's happening.)

gperciva commented 9 months ago

Oh, in case it's relevant for ENOTCONN: original report on Linux, but I reproduced it on FreeBSD 14.0-RELEASE-p3.