Re: sharing a dict between child processes

Glyph <[email protected]> Thu, 7 Nov 2019 15:39:40 -0800
Newsgroups gmane.comp.python.twisted
Message-ID <[email protected]>
--===============6403429841118453450==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_67E612FB-732C-4596-97EF-A03B4FD1DB92"


--Apple-Mail=_67E612FB-732C-4596-97EF-A03B4FD1DB92
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii



> On Nov 7, 2019, at 2:07 AM, Scott, Barry <[email protected]> =
wrote:
>=20
> On Thursday, 7 November 2019 05:29:34 GMT Sean DiZazzo wrote:
>> If you need guaranteed delivery of the data, why not just use a TCP
>> connection to the unix socket, instead of a UDP connection which =
inherently
>> can lose data?  In that case I don't think your patch would be =
needed.
>>=20
>> I didn't look at the source, so perhaps I missed something.
>=20
> UDS is not UDP.=20

Specifically, a UNIX datagram socket is a datagram-based IPC mechanism =
but unlike UDP it is not unreliable.  You can still get EAGAIN or =
EMSGSIZE because buffers fill up and datagrams are too big, but if you =
put a datagram in, it comes out again.  Barry's (embarrassingly =
long-standing) bug in Twisted's handling of UDS failures is here: =
https://twistedmatrix.com/trac/ticket/9504 =
<https://twistedmatrix.com/trac/ticket/9504> .

You can't make "a TCP connection" to a UNIX-domain socket; TCP is a =
thing you do over networks and the UNIX address family is for local =
inter-process communication on a single host.

>>> We use the UDS (Unix domain sockets) to talk to a master process.
>>> Twisted has support for this. But you need a small patch to avoid =
data
>>> lose.
>>>=20
>>> UDS does not lose data and is message based, not bytes based. We
>>> use pickle to encode requests and responses.
>=20
> Barry
>=20
>=20
>=20
> _______________________________________________
> Twisted-Python mailing list
> [email protected]
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


--Apple-Mail=_67E612FB-732C-4596-97EF-A03B4FD1DB92
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Nov 7, 2019, at 2:07 AM, Scott, Barry &lt;<a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div class=3D"">On =
Thursday, 7 November 2019 05:29:34 GMT Sean DiZazzo wrote:<br =
class=3D""><blockquote type=3D"cite" class=3D"">If you need guaranteed =
delivery of the data, why not just use a TCP<br class=3D"">connection to =
the unix socket, instead of a UDP connection which inherently<br =
class=3D"">can lose data? &nbsp;In that case I don't think your patch =
would be needed.<br class=3D""><br class=3D"">I didn't look at the =
source, so perhaps I missed something.<br class=3D""></blockquote><br =
class=3D"">UDS is not UDP. <br =
class=3D""></div></div></blockquote><div><br =
class=3D""></div><div>Specifically, a UNIX datagram socket is a =
datagram-based IPC mechanism but unlike UDP it is <i =
class=3D"">not</i><span style=3D"font-style: normal;" =
class=3D"">&nbsp;unreliable. &nbsp;You can still get EAGAIN or EMSGSIZE =
because buffers fill up and datagrams are too big, but if you put a =
datagram in, it comes out again. &nbsp;Barry's (embarrassingly =
long-standing) bug in Twisted's handling of UDS failures is =
here:&nbsp;</span><a href=3D"https://twistedmatrix.com/trac/ticket/9504" =
class=3D"">https://twistedmatrix.com/trac/ticket/9504</a>&nbsp;.</div><div=
><span style=3D"font-style: normal;" class=3D""><br =
class=3D""></span></div><div><span style=3D"font-style: normal;" =
class=3D"">You can't make "a TCP connection" to a UNIX-domain socket; =
TCP is a thing you do over networks and the UNIX address family is for =
local inter-process communication on a single host.</span></div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><div =
class=3D""><blockquote type=3D"cite" class=3D""><blockquote type=3D"cite" =
class=3D"">We use the UDS (Unix domain sockets) to talk to a master =
process.<br class=3D"">Twisted has support for this. But you need a =
small patch to avoid data<br class=3D"">lose.<br class=3D""><br =
class=3D"">UDS does not lose data and is message based, not bytes based. =
We<br class=3D"">use pickle to encode requests and responses.<br =
class=3D""></blockquote></blockquote><br class=3D"">Barry<br =
class=3D""><br class=3D""><br class=3D""><br =
class=3D"">_______________________________________________<br =
class=3D"">Twisted-Python mailing list<br class=3D""><a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br =
class=3D"">https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-pyth=
on<br class=3D""></div></div></blockquote></div><br =
class=3D""></body></html>=

--Apple-Mail=_67E612FB-732C-4596-97EF-A03B4FD1DB92--


--===============6403429841118453450==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHdpc3RlZC1Q
eXRob24gbWFpbGluZyBsaXN0ClR3aXN0ZWQtUHl0aG9uQHR3aXN0ZWRtYXRyaXguY29tCmh0dHBz
Oi8vdHdpc3RlZG1hdHJpeC5jb20vY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3R3aXN0ZWQtcHl0
aG9uCg==

--===============6403429841118453450==--