SCTP stream socket read(2) can block a process

Bernd Walter ticso at cicely7.cicely.de
Wed Apr 16 01:02:04 UTC 2014


On Wed, Apr 16, 2014 at 01:54:19AM +0200, Bernd Walter wrote:
> When using SCTP in TCP like stream style.
> socket(2)
> connect(2)
> write(2) request
> read(2) answer
> 
> When the other side disconnects the association (e.g. process restarted)
> after the write and before read call the read never returns.

I wasn't correct - it happened to me after calling read(2), but before
the other side send anything back, so the read(2) was already in kernel
when the other side closed it's end.

> With TCP stream sockets the read would return with an error instead.
> SCTP are not TCP, but the other side can't associate back in on such
> a connect(2) socket, so returning would be expected.
> I've switched to nonblocking with timeout in the meantime - I wanted
> to have a response timeout anyway.
> In my test case the other side was a one2many socket on the same host.
> 
> -- 
> B.Walter <bernd at bwct.de> http://www.bwct.de
> Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.


More information about the freebsd-net mailing list