From: Matthew Wilcox <willy@infradead.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: rao.shoaib@oracle.com, Christoph Hellwig <hch@lst.de>,
Paolo Abeni <pabeni@redhat.com>,
jbi.octave@gmail.com, Linux API <linux-api@vger.kernel.org>
Subject: Re: [RFC net-next af_unix v1 0/1] Allow delivery of SIGURG on AF_UNIX streams socket
Date: Mon, 7 Dec 2020 16:35:20 +0000 [thread overview]
Message-ID: <20201207163520.GA7494@casper.infradead.org> (raw)
In-Reply-To: <CALCETrUKuzwU=xiDq8Kk8H-bE1R6K-pN5ZhCFWH9bxR+_Z=NwA@mail.gmail.com>
On Sat, Nov 28, 2020 at 08:02:37PM -0800, Andy Lutomirski wrote:
> On Sat, Nov 28, 2020 at 7:07 PM <rao.shoaib@oracle.com> wrote:
> > We have a use case where thousands of processes connect locally to a
> > database and issue queries that are serviced by a pool of threads.
> > Communication is done over AF_UNIX sockets. Currently, there is no way
> > for the submitter to signal the servicing thread about an urgent
> > condition such as abandoning the query.
>
> Sure there is. You could close() the socket. You could send() a
> message saying that your query wants to be canceled. You could use a
> second socket for this if it's somehow inconvenient to do it with a
> single socket.
The application already works with SIGURG (and TCP, obviously). Yes,
it could be changed to use one of these other methods, but they're all
more inconvenient to use than SIGURG.
> > This patch addresses that
> > requirement by adding support for MSG_OOB flag for AF_UNIX sockets.
> > On receipt of such a flag, the kernel sends a SIGURG to the peer.
>
> SIGURG is a horrible interface. It doesn't scale -- signals are slow,
> and they give no indication of *which* socket has urgent data.
It doesn't need to scale. This is "client wishes to abort the operation",
just like telnet. Each thread only has one socket (and, thanks to
F_SETOWN_EX, signals for that socket get directed to that thread).
> Aside
> from this, the "urgent" interface itself is nuts -- even the TCP RFCs
> and implementations seem unable to agree on exactly how to tell
> *which* data is urgent.
That doesn't matter. Unix sockets with MSG_OOB behave like they
have had SO_OOBINLINE which is the recommendation from
https://tools.ietf.org/html/rfc6093
> At least epoll might be a scalable way to
> tell which socket has urgent data, but that's not what your patch
> description seems to be talking about.
epoll is the wrong interface for this application, as far as I can tell.
> Oh yeah, SIGURG simply doesn't work across privilege boundaries.
Please elaborate. SIGURG is default-ignore, so you have to enable a
handler for it. And you have to call SETOWN to receive a signal.
> I'm also a bit nervous that there might be some program out there that
> expects SIGIO but not SIGURG on unix sockets, and you're breaking
> them.
The only incompatible scenario I've been able to think of is an
application which has both TCP and Unix sockets will suddenly get its
SIGURG handler called for Unix sockets when it's only expecting to get
it called for TCP sockets. That feels like a very unlikely scenario.
next prev parent reply other threads:[~2020-12-07 16:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-29 2:52 [RFC net-next af_unix v1 0/1] Allow delivery of SIGURG on AF_UNIX streams socket rao.shoaib
2020-11-29 2:52 ` [RFC net-next af_unix v1 1/1] af_unix: " rao.shoaib
2020-11-29 4:02 ` [RFC net-next af_unix v1 0/1] " Andy Lutomirski
2020-11-30 6:24 ` Rao Shoaib
2020-12-07 16:35 ` Matthew Wilcox [this message]
2020-12-07 17:00 ` Andy Lutomirski
2020-12-07 18:51 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201207163520.GA7494@casper.infradead.org \
--to=willy@infradead.org \
--cc=hch@lst.de \
--cc=jbi.octave@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=luto@kernel.org \
--cc=pabeni@redhat.com \
--cc=rao.shoaib@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).