kivy/oscpy

New Windows issue (with current code including fix #48)

JPfeP opened this issue · 3 comments

JPfeP commented

Hi tshirtman,

A simple stop_all() on a server is producing an error message on Win10 (not on Linux):

Traceback (most recent call last):
  File "D:\blender-2.80-windows64\2.80\python\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "D:\blender-2.80-windows64\2.80\python\lib\threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "C:\users\hebus\Application Data\Blender Foundation\Blender\2.80\scripts\addons\MOM\oscpy\server.py", line 336, in _listen
    data, sender = sender_socket.recvfrom(65535)
OSError: [WinError 10038] Windows Error 0x2736

This happens despite the recent try/catch because its an OSError and not a ConnectionResetError that the new code can intercept.
I edited manually the line 337 to catch all errors as a workaround and my code can now stop the server and reconnect successfully. You will of course determinate a proper solution.

I found this while googling on the error message:
https://stackoverflow.com/questions/35889267/an-operation-was-attempted-on-something-that-is-not-a-socket-tried-fixing-a-lot

So i pushed a branch for that, but i really have no idea about how to make a test that show the bug, tried https://github.com/kivy/oscpy/pull/51/files#diff-b9ad2c13b5324b6b836c622979c627e8R932 but it seems to behave really weirdly, passing very fast on linux and windows with 2.7, but running for ages in windows/python3. I would expect it to fail without the attached fix, but it wasn't when i pushed the test without the fix.

#51

Similar error with stop() and stop_all()

I used https://github.com/tshirtman/kivy_service_osc
And passed a message to set a flag to break from the send_date() loop and added a SERVER.stop()

FYI this was trying to work around tshirtman/kivy_service_osc#9

 Exception in thread Thread-3:
 Traceback (most recent call last):
   File "C:\Users\Bobf\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
     self.run()
   File "C:\Users\Bobf\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
     self._target(*self._args, **self._kwargs)
   File "C:\Users\Bobf\AppData\Local\Programs\Python\Python38\lib\site-packages\oscpy\server.py", line 335, in _listen
     data, sender = sender_socket.recvfrom(65535)
 OSError: [WinError 10038] An operation was attempted on something that is not a socket

Found a solution to my issue with oscpy==master
tshirtman/kivy_service_osc#9 (comment)