Thread (4 messages) 4 messages, 2 authors, 2024-06-07

SCTP doesn't seem to let you 'cancel' a blocking accept()

From: David Laight <hidden>
Date: 2024-06-03 15:41:22
Also in: linux-sctp

In a multithreaded program it is reasonable to have a thread blocked in accept().
With TCP a subsequent shutdown(listen_fd, SHUT_RDWR) causes the accept to fail.
But nothing happens for SCTP.

I think the 'magic' happens when tcp_disconnect() calls inet_csk_listen_stop(sk)
but sctp_disconnect() is an empty function and nothing happens.

I can't see any calls to inet_csk_listen_stop() in the sctp code - so I suspect
it isn't possible at all.

This all relates to a very old (pre git) comment in inet_shutdown() that
shutdown needs to act on listening and connecting sockets until the VFS
layer is 'fixed' (presumably to let close() through - not going to happen.)

I also suspect that a blocking connect() can't be cancelled either?

Clearly the application can avoid the issue by using poll() and an
extra eventfd() for the wakeup - but it is all a faff for code that
otherwise straight forward.

		David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help