public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* python > 3.5: Issue with unix domain sockets
@ 2021-05-03 12:57 Maximilian.Blenk
  2021-05-03 13:58 ` Ken Brown
  2021-05-05  9:10 ` Marco Atzeri
  0 siblings, 2 replies; 6+ messages in thread
From: Maximilian.Blenk @ 2021-05-03 12:57 UTC (permalink / raw)
  To: cygwin

Hello everyone,

I noticed that latest Cygwin release (3.2.0-1) has an issue with python and unix domain sockets, although I’m not a 100% sure about the root cause. My best guess is that something is wrong with the unix domain dockets implementation. I would like to attach the cygcheck.out but it seems to exceed the 180kb limit mentioned on the website (even zipped)

Simple Reproducer:
I tried to get the example shown at https://pymotw.com/3/socket/uds.html working. It works if I execute it with python3.5 (both client and server), but it doesn’t if I use python3.6 or newer (actually tested 3.6 and 3.7 on Windows 10):

Correct Behavior:
Server:
$ python3.5 server.py
starting up on ./uds_socket
waiting for a connection
connection from
received b'This is the mess'
sending data back to the client
received b'age.  It will be'
sending data back to the client
received b' repeated.'
sending data back to the client
received b''
no data from
waiting for a connection
…

Client:
$ python3.5 client.py
connecting to ./uds_socket
sending b'This is the message.  It will be repeated.'
received b'This is the mess'
received b'age.  It will be'
received b' repeated.'
closing socket

Incorrect Behavior:
Server:
$ python3.7 server.py
starting up on ./uds_socket
waiting for a connection
Traceback (most recent call last):
  File "server.py", line 27, in <module>
    connection, client_address = sock.accept()
  File "/usr/lib/python3.7/socket.py", line 214, in accept
    sock = socket(self.family, self.type, self.proto, fileno=fd)
  File "/usr/lib/python3.7/socket.py", line 151, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
SystemError: <slot wrapper '__init__' of '_socket.socket' objects> returned NULL without setting an error

Client:
$ python3.7 client.py
connecting to ./uds_socket
sending b'This is the message.  It will be repeated.'
closing socket
Traceback (most recent call last):
  File "client.py", line 27, in <module>
    data = sock.recv(16)
ConnectionResetError: [Errno 104] Connection reset by peer


Am I missing something? 

BR Max

--

BMW Car IT GmbH
Maximilian Blenk
Security Engineer

Lise-Meitner-Str. 14
89081 Ulm

Web: http://www.bmw-carit.de
------------------------------------------------------
BMW Car IT GmbH
Geschäftsführer: Kai-Uwe Balszuweit und Michael Böttrich
Sitz und Registergericht: München HRB 134810
------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: python > 3.5: Issue with unix domain sockets
  2021-05-03 12:57 python > 3.5: Issue with unix domain sockets Maximilian.Blenk
@ 2021-05-03 13:58 ` Ken Brown
  2021-05-04  4:41   ` Mark Geisert
  2021-05-05  9:10 ` Marco Atzeri
  1 sibling, 1 reply; 6+ messages in thread
From: Ken Brown @ 2021-05-03 13:58 UTC (permalink / raw)
  To: cygwin



On 5/3/2021 8:57 AM, Maximilian.Blenk--- via Cygwin wrote:
> Hello everyone,
> 
> I noticed that latest Cygwin release (3.2.0-1) has an issue with python and unix domain sockets, although I’m not a 100% sure about the root cause. My best guess is that something is wrong with the unix domain dockets implementation. I would like to attach the cygcheck.out but it seems to exceed the 180kb limit mentioned on the website (even zipped)
> 
> Simple Reproducer:
> I tried to get the example shown at https://pymotw.com/3/socket/uds.html working. It works if I execute it with python3.5 (both client and server), but it doesn’t if I use python3.6 or newer (actually tested 3.6 and 3.7 on Windows 10):
> 
> Correct Behavior:
> Server:
> $ python3.5 server.py
> starting up on ./uds_socket
> waiting for a connection
> connection from
> received b'This is the mess'
> sending data back to the client
> received b'age.  It will be'
> sending data back to the client
> received b' repeated.'
> sending data back to the client
> received b''
> no data from
> waiting for a connection
> …
> 
> Client:
> $ python3.5 client.py
> connecting to ./uds_socket
> sending b'This is the message.  It will be repeated.'
> received b'This is the mess'
> received b'age.  It will be'
> received b' repeated.'
> closing socket
> 
> Incorrect Behavior:
> Server:
> $ python3.7 server.py
> starting up on ./uds_socket
> waiting for a connection
> Traceback (most recent call last):
>    File "server.py", line 27, in <module>
>      connection, client_address = sock.accept()
>    File "/usr/lib/python3.7/socket.py", line 214, in accept
>      sock = socket(self.family, self.type, self.proto, fileno=fd)
>    File "/usr/lib/python3.7/socket.py", line 151, in __init__
>      _socket.socket.__init__(self, family, type, proto, fileno)
> SystemError: <slot wrapper '__init__' of '_socket.socket' objects> returned NULL without setting an error
> 
> Client:
> $ python3.7 client.py
> connecting to ./uds_socket
> sending b'This is the message.  It will be repeated.'
> closing socket
> Traceback (most recent call last):
>    File "client.py", line 27, in <module>
>      data = sock.recv(16)
> ConnectionResetError: [Errno 104] Connection reset by peer

I wonder if this has the same cause as the problem reported here:

   https://cygwin.com/pipermail/cygwin/2021-February/247884.html

Mark, can you check that?

Ken

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: python > 3.5: Issue with unix domain sockets
  2021-05-03 13:58 ` Ken Brown
@ 2021-05-04  4:41   ` Mark Geisert
  2021-05-04  5:42     ` Marco Atzeri
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Geisert @ 2021-05-04  4:41 UTC (permalink / raw)
  To: cygwin

Ken Brown via Cygwin wrote:
> On 5/3/2021 8:57 AM, Maximilian.Blenk--- via Cygwin wrote:
>> Incorrect Behavior:
>> Server:
>> $ python3.7 server.py
>> starting up on ./uds_socket
>> waiting for a connection
>> Traceback (most recent call last):
>>    File "server.py", line 27, in <module>
>>      connection, client_address = sock.accept()
>>    File "/usr/lib/python3.7/socket.py", line 214, in accept
>>      sock = socket(self.family, self.type, self.proto, fileno=fd)
>>    File "/usr/lib/python3.7/socket.py", line 151, in __init__
>>      _socket.socket.__init__(self, family, type, proto, fileno)
>> SystemError: <slot wrapper '__init__' of '_socket.socket' objects> returned NULL 
>> without setting an error
>>
>> Client:
>> $ python3.7 client.py
>> connecting to ./uds_socket
>> sending b'This is the message.  It will be repeated.'
>> closing socket
>> Traceback (most recent call last):
>>    File "client.py", line 27, in <module>
>>      data = sock.recv(16)
>> ConnectionResetError: [Errno 104] Connection reset by peer
> 
> I wonder if this has the same cause as the problem reported here:
> 
>    https://cygwin.com/pipermail/cygwin/2021-February/247884.html
> 
> Mark, can you check that?

Hmm, the correlation between failing Python versions and patch placements is 
troubling.  I've reproduced the OP's findings and will dig further.

..mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: python > 3.5: Issue with unix domain sockets
  2021-05-04  4:41   ` Mark Geisert
@ 2021-05-04  5:42     ` Marco Atzeri
  2021-05-04  9:21       ` Mark Geisert
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Atzeri @ 2021-05-04  5:42 UTC (permalink / raw)
  To: cygwin


On 04.05.2021 06:41, Mark Geisert wrote:
> Ken Brown via Cygwin wrote:
>> On 5/3/2021 8:57 AM, Maximilian.Blenk--- via Cygwin wrote:
>>> Incorrect Behavior:
>>> Server:
>>> $ python3.7 server.py
>>> starting up on ./uds_socket
>>> waiting for a connection
>>> Traceback (most recent call last):
>>>    File "server.py", line 27, in <module>
>>>      connection, client_address = sock.accept()
>>>    File "/usr/lib/python3.7/socket.py", line 214, in accept
>>>      sock = socket(self.family, self.type, self.proto, fileno=fd)
>>>    File "/usr/lib/python3.7/socket.py", line 151, in __init__
>>>      _socket.socket.__init__(self, family, type, proto, fileno)
>>> SystemError: <slot wrapper '__init__' of '_socket.socket' objects> 
>>> returned NULL without setting an error
>>>
>>> Client:
>>> $ python3.7 client.py
>>> connecting to ./uds_socket
>>> sending b'This is the message.  It will be repeated.'
>>> closing socket
>>> Traceback (most recent call last):
>>>    File "client.py", line 27, in <module>
>>>      data = sock.recv(16)
>>> ConnectionResetError: [Errno 104] Connection reset by peer
>>
>> I wonder if this has the same cause as the problem reported here:
>>
>>    https://cygwin.com/pipermail/cygwin/2021-February/247884.html
>>
>> Mark, can you check that?
> 
> Hmm, the correlation between failing Python versions and patch 
> placements is troubling.  I've reproduced the OP's findings and will dig 
> further.
> 
> ..mark
> 

3.5 has not your patch for asyncio, as I am not updating it.

all the others have it. It will be nice to solve this problem and avoid 
the freeze that your patch solved.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: python > 3.5: Issue with unix domain sockets
  2021-05-04  5:42     ` Marco Atzeri
@ 2021-05-04  9:21       ` Mark Geisert
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Geisert @ 2021-05-04  9:21 UTC (permalink / raw)
  To: cygwin

Marco Atzeri via Cygwin wrote:
> 
> On 04.05.2021 06:41, Mark Geisert wrote:
>> Ken Brown via Cygwin wrote:
>>> On 5/3/2021 8:57 AM, Maximilian.Blenk--- via Cygwin wrote:
>>>> Incorrect Behavior:
>>>> Server:
>>>> $ python3.7 server.py
>>>> starting up on ./uds_socket
>>>> waiting for a connection
>>>> Traceback (most recent call last):
>>>>    File "server.py", line 27, in <module>
>>>>      connection, client_address = sock.accept()
>>>>    File "/usr/lib/python3.7/socket.py", line 214, in accept
>>>>      sock = socket(self.family, self.type, self.proto, fileno=fd)
>>>>    File "/usr/lib/python3.7/socket.py", line 151, in __init__
>>>>      _socket.socket.__init__(self, family, type, proto, fileno)
>>>> SystemError: <slot wrapper '__init__' of '_socket.socket' objects> returned 
>>>> NULL without setting an error
>>>>
>>>> Client:
>>>> $ python3.7 client.py
>>>> connecting to ./uds_socket
>>>> sending b'This is the message.  It will be repeated.'
>>>> closing socket
>>>> Traceback (most recent call last):
>>>>    File "client.py", line 27, in <module>
>>>>      data = sock.recv(16)
>>>> ConnectionResetError: [Errno 104] Connection reset by peer
>>>
>>> I wonder if this has the same cause as the problem reported here:
>>>
>>>    https://cygwin.com/pipermail/cygwin/2021-February/247884.html
>>>
>>> Mark, can you check that?
>>
>> Hmm, the correlation between failing Python versions and patch placements is 
>> troubling.  I've reproduced the OP's findings and will dig further.
>>
>> ..mark
>>
> 
> 3.5 has not your patch for asyncio, as I am not updating it.
> 
> all the others have it. It will be nice to solve this problem and avoid the freeze 
> that your patch solved.

Agreed; fortunate here to have 3.5 frozen.  I see the cause.  I'm taking this to 
cygwin-developers and will respond here when we have a solution at hand.

..mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: python > 3.5: Issue with unix domain sockets
  2021-05-03 12:57 python > 3.5: Issue with unix domain sockets Maximilian.Blenk
  2021-05-03 13:58 ` Ken Brown
@ 2021-05-05  9:10 ` Marco Atzeri
  1 sibling, 0 replies; 6+ messages in thread
From: Marco Atzeri @ 2021-05-05  9:10 UTC (permalink / raw)
  To: cygwin

On 03.05.2021 14:57, Maximilian.Blenk--- via Cygwin wrote:
> Hello everyone,
> 
> I noticed that latest Cygwin release (3.2.0-1) has an issue with python and unix domain sockets, although I’m not a 100% sure about the root cause. My best guess is that something is wrong with the unix domain dockets implementation. I would like to attach the cygcheck.out but it seems to exceed the 180kb limit mentioned on the website (even zipped)
> 
> Simple Reproducer:
> I tried to get the example shown at https://pymotw.com/3/socket/uds.html working. It works if I execute it with python3.5 (both client and server), but it doesn’t if I use python3.6 or newer (actually tested 3.6 and 3.7 on Windows 10):
> 
> Correct Behavior:
> Server:
> $ python3.5 server.py
> starting up on ./uds_socket
> waiting for a connection
> connection from
> received b'This is the mess'
> sending data back to the client
> received b'age.  It will be'
> sending data back to the client
> received b' repeated.'
> sending data back to the client
> received b''
> no data from
> waiting for a connection
> …
> 
> Client:
> $ python3.5 client.py
> connecting to ./uds_socket
> sending b'This is the message.  It will be repeated.'
> received b'This is the mess'
> received b'age.  It will be'
> received b' repeated.'
> closing socket
> 
> Incorrect Behavior:
> Server:
> $ python3.7 server.py
> starting up on ./uds_socket
> waiting for a connection
> Traceback (most recent call last):
>    File "server.py", line 27, in <module>
>      connection, client_address = sock.accept()
>    File "/usr/lib/python3.7/socket.py", line 214, in accept
>      sock = socket(self.family, self.type, self.proto, fileno=fd)
>    File "/usr/lib/python3.7/socket.py", line 151, in __init__
>      _socket.socket.__init__(self, family, type, proto, fileno)
> SystemError: <slot wrapper '__init__' of '_socket.socket' objects> returned NULL without setting an error
> 
> Client:
> $ python3.7 client.py
> connecting to ./uds_socket
> sending b'This is the message.  It will be repeated.'
> closing socket
> Traceback (most recent call last):
>    File "client.py", line 27, in <module>
>      data = sock.recv(16)
> ConnectionResetError: [Errno 104] Connection reset by peer
> 
> 
> Am I missing something?
> 
> BR Max
> 

Hi Max,
thanks for the example.

Mark Geisert provided me a solution and it passes your
test case on python3.8 and it seems to not add other problem
at list in my tests.

give me some time to update all packages (3.6, 3.7, 3.8) for
both architecture in the coming days

Regards
Marco

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-05  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 12:57 python > 3.5: Issue with unix domain sockets Maximilian.Blenk
2021-05-03 13:58 ` Ken Brown
2021-05-04  4:41   ` Mark Geisert
2021-05-04  5:42     ` Marco Atzeri
2021-05-04  9:21       ` Mark Geisert
2021-05-05  9:10 ` Marco Atzeri

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).