public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: The unreliability of AF_UNIX datagram sockets
Date: Thu, 29 Apr 2021 19:39:26 +0200	[thread overview]
Message-ID: <YIrvTiytEebHIBPc@calimero.vinschen.de> (raw)
In-Reply-To: <16e1d55e-15ea-6c0e-04e4-aa6cb2c0c1bd@cornell.edu>

On Apr 29 12:44, Ken Brown wrote:
> On 4/29/2021 11:05 AM, Corinna Vinschen wrote:
> > So maybe we should really think hard about the alternative
> > implementation using POSIX message queues, I guess.  And *if* we do
> > that, this should be used likewise for STREAM as for DGRAM sockets, so
> > the code is easier to maintain.  Obvious advantage: No problem with
> > older OS versions.  And maybe it's even dirt easy to implement in
> > comparison with using other methods, because the transport mechanism
> > is already in place.
> 
> Yes, I don't think it should be too hard.  The one thing I can think of
> that's missing is a facility for doing a partial read of a message on the
> message queue.  (This would be needed for a recv call on a STREAM socket, in
> which the buffer is smaller than the payload of the next message on the
> queue.)  But this should be straightforward to implement.
> 
> Alternatively, I guess we could read the whole message and store the excess
> in a readahead buffer.

Alternatively, we could introduce a new, internal-only method into the
POSIX msq code, one that reads a partial message, reduces the message
to the remainder and keeps it on the queue head...

> On 4/29/2021 11:18 AM, Corinna Vinschen wrote:
> > While searching the net I found this additional gem of information:
> >
> > Native AF_UNIX sockets don't support abstract sockets.  You must bind to
> > a valid path, so you always have a visible file in the filesystem.
> > Discussed here: https://github.com/microsoft/WSL/issues/4240
> >
> > We could workaround that with our POSIX unlink semantics, probably,
> > but it's YA downside
> 
> Agreed.  The more features that are missing from native AF_UNIX sockets, the
> less appealing they become.
> 
> Concerning abstract sockets, would we still have an issue if we used message
> queues?  Wouldn't there be a visible file under /dev/mqueue?  Or is there a
> way around that?

Good point!  There's no way around that yet.  In theory that shouldn't
matter because /dev/mqueue is kind of a "virtual" path, even if Cygwin
implements the queues as real files.  But that's setting the perspective
straight, we're in fact no better than the native AF_UNIX here ¯\_(ツ)_/¯

Probably we should actually add an internal-only way of creating
non-file backed mqueues for the purpose of adding abstract sockets.


Corinna

  reply	other threads:[~2021-04-29 17:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 15:47 Ken Brown
2021-04-29 11:05 ` Corinna Vinschen
2021-04-29 11:16   ` Corinna Vinschen
2021-04-29 14:38   ` Ken Brown
2021-04-29 15:05     ` Corinna Vinschen
2021-04-29 15:18       ` Corinna Vinschen
2021-04-29 16:44       ` Ken Brown
2021-04-29 17:39         ` Corinna Vinschen [this message]
2021-05-01 21:41           ` Ken Brown
2021-05-03 10:30             ` Corinna Vinschen
2021-05-03 15:45               ` Corinna Vinschen
2021-05-03 16:56                 ` Ken Brown
2021-05-03 18:40                   ` Corinna Vinschen
2021-05-03 19:48                     ` Ken Brown
2021-05-03 20:50                       ` Ken Brown
2021-05-04 11:06                         ` Corinna Vinschen
2021-05-13 14:30                           ` Ken Brown
2021-05-17 10:26                             ` Corinna Vinschen
2021-05-17 13:02                               ` Ken Brown
2021-05-17 13:02                               ` Ken Brown
2021-05-20 13:46   ` Ken Brown
2021-05-20 19:25     ` Corinna Vinschen
2021-05-21 21:54       ` Ken Brown
2021-05-22 15:49         ` Corinna Vinschen
2021-05-22 16:50           ` Ken Brown
2021-05-22 18:21             ` Ken Brown

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=YIrvTiytEebHIBPc@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.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 read-only IMAP folder(s) and NNTP newsgroup(s).