Page MenuHomeFreeBSD

Make asynchronous connection failures on UNIX sockets fail with ECONNRESET.
ClosedPublic

Authored by ed on Feb 24 2016, 11:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 28 2024, 4:37 PM
Unknown Object (File)
Dec 29 2023, 11:26 AM
Unknown Object (File)
Dec 20 2023, 2:11 AM
Unknown Object (File)
Nov 6 2023, 11:01 AM
Unknown Object (File)
Aug 29 2023, 7:35 AM
Unknown Object (File)
Aug 19 2023, 5:07 AM
Unknown Object (File)
Jul 16 2023, 6:50 AM
Unknown Object (File)
Jul 9 2023, 4:58 AM
Subscribers

Details

Summary

While making CloudABI work well on Linux, I discovered that I had a
FreeBSD-ism in one of my unit tests. The test did the following:

  • Create UNIX socket 1, bind it, make it listen.
  • Create UNIX socket 2, connect it to UNIX socket 1.
  • Close UNIX socket 1.
  • Obtain SO_ERROR from socket 2.

On FreeBSD this returns ECONNABORTED, while on Linux it returns
ECONNRESET. I dug through some of the relevant specifications and it
looks like Linux is all right here. ECONNABORTED should only be returned
when the local connection (socket 2) is aborted; not the peer (socket 1).

It is of course slightly misleading: the function in which we set this
error is called uipc_abort(), but keep in mind that we're aborting the
peer, thus resetting the local socket.

Test Plan

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Make asynchronous connection failures on UNIX sockets fail with ECONNRESET..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: cem, mjg, glebius.
cem edited edge metadata.

I dug through some of the relevant specifications and it
looks like Linux is all right here.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html

This revision is now accepted and ready to land.Feb 24 2016, 4:38 PM
This revision was automatically updated to reflect the committed changes.