This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Make create_unix_server for SOCK_DGRAM work
Type: enhancement Stage:
Components: asyncio Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, holger+lp, yselivanov
Priority: normal Keywords:

Created on 2018-01-29 22:29 by holger+lp, last changed 2022-04-11 14:58 by admin.

Messages (4)
msg311188 - (view) Author: holger (holger+lp) Date: 2018-01-29 22:29
The current implementation verifies that the sock passed is a stream socket. This limitation appears to be arbitrary and is limiting.

* An AF_UNIX SOCK_DGRAM server socket becomes readable when one can accept(2) it. Just like SOCK_STREAM.
* One could provide a different factory to create a reader/writer to use a SOCK_DGRAM socket (but most likely nothing special is needed)
* A connected AF_UNIX SOCK_DGRAM socket will work with normal read/write messages just like SOCK_STREAM.

AF_UNIX, SOCK_DGRAM is interesting because it provides a reliable transport for messages. This avoids having to write message segmentation or packing messages in any kind of envelope.
msg311192 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-29 22:37
SOCK_DGRAM is never reliable, even for AF_UNIX.  It might appear reliable to your test code, but there's no guarantee for that under any OS in Posix standard AFAIK.
msg311196 - (view) Author: holger (holger+lp) Date: 2018-01-29 23:06
Could you please tell me which exact posix document and paragraph says that?

In Linux sending can fail but once sendmsg worked the message is enqueued on the other socket (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/unix/af_unix.c?id=110af3acb8cfd79dcb5676a01e07cb2b6afa4c04#n1626).

In FreeBSD (http://fxr.watson.org/fxr/source/kern/uipc_usrreq.c?v=FREEBSD10#L911) it looks similar. If the mbuf can't be put into the recvq of the remote socket.. an error will be returned.

What about SEQPACKET support?
msg311198 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-29 23:16
Hm, maybe I'm mistaken here, but I have no time right now to confirm.

I'll reopen the issue so that we can consider this (and especially SEQPACKET) for 3.8.  Sorry for insta-reject :)
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76896
2018-01-29 23:16:47yselivanovsetstatus: closed -> open
type: behavior -> enhancement
messages: + msg311198

resolution: rejected ->
stage: resolved ->
2018-01-29 23:06:20holger+lpsetmessages: + msg311196
2018-01-29 22:37:06yselivanovsetstatus: open -> closed
resolution: rejected
messages: + msg311192

stage: resolved
2018-01-29 22:29:49holger+lpcreate