multiprocTCPBase on Windows 10

40 views
Skip to first unread message

Wolfgang Funk

unread,
Feb 11, 2024, 6:27:28 AM2/11/24
to thespian.py
Hello everybody!

Are there any known problems starting a multiprocTCPBase system on Windows 10?
The following code works fine on Linux (Ubuntu 22.04):

import socket
import sys
from thespian.actors import ActorSystem

if __name__ == "__main__":
    port = 1900  # we run on Thespian's standard port
    try:
        ip = sys.argv[1]  # server IP given on command line
    except IndexError:
        ip = socket.gethostbyname(socket.gethostname())
    print(f"Starting server on {ip}:{port}")
    capabilities = {"Convention Address.IPv4": (ip, port), "Server": True}
    actor_system = ActorSystem("multiprocTCPBase", capabilities=capabilities)

On Windows 10 (port 1900 is ok, firewall disabled):

Traceback (most recent call last):
  File "E:\Code\TestServer\test_server.py", line 13, in <module>
    actor_system = ActorSystem("multiprocTCPBase", capabilities=capabilities)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wfunk\Envs\awe\Lib\site-packages\thespian\actors.py", line 637, in __init__
    systemBase = self._startupActorSys(
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wfunk\Envs\awe\Lib\site-packages\thespian\actors.py", line 678, in _startupActorSys
    systemBase = sbc(self, logDefs=logDefs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wfunk\Envs\awe\Lib\site-packages\thespian\system\multiprocTCPBase.py", line 28, in __init__
    super(ActorSystemBase, self).__init__(system, logDefs)
  File "C:\Users\wfunk\Envs\awe\Lib\site-packages\thespian\system\multiprocCommon.py", line 83, in __init__
    super(multiprocessCommon, self).__init__(system, logDefs)
  File "C:\Users\wfunk\Envs\awe\Lib\site-packages\thespian\system\systemBase.py", line 335, in __init__
    raise InvalidActorAddress(self.adminAddr,
thespian.actors.InvalidActorAddress: ActorAddr-(T|:1900) is not a valid or useable ActorSystem Admin


Strange thing (to me): multiprocUDPBase works on Windows 10. Are there any known issues or workarounds here? Are there any configuration options for Thespian I've been missing? May be there is some OS configuration issue here?

Any help is greatly appreciated!

Best regards
Wolfgang

Kevin Quick

unread,
Feb 12, 2024, 8:33:23 PM2/12/24
to Wolfgang Funk, thespian.py
Hi Wolfgang,

My usual assumption with Windows is either a firewall or a virus
protector. You indicated that the firewall was disabled, but IIRC
there are several levels of firewalling in Windows.

There is a diagnostic script that may provide more information:
thespian/diagnose.py . If you run that, it may provide more
information to suggest a solution.

Regards,
Kevin
> --
> You received this message because you are subscribed to the Google Groups "thespian.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/5d1bffbe-aba7-48af-ae9b-0e4fd5dbd847n%40googlegroups.com.



--
-KQ

Wolfgang Funk

unread,
Feb 14, 2024, 7:07:51 AM2/14/24
to thespian.py
Hi Kevin,

thanks for getting back to me! The diagnose script gave the following output (no matter if firewall and virus protection enabled):

--- start of script output on console ---

Initiating diagnostics
   [......Python] : namespace(name='cpython', cache_tag='cpython-312', version=sys.version_info(major=3, minor=12, micro=1, releaselevel='final', serial=0), hexversion=51118576)
   [.........(t)] : sys.thread_info(name='nt', lock=None, version=None)
   [.........(p)] : win32
   [........(mp)] : [<_distutils_hack.DistutilsMetaFinder object at 0x0000018735A9E090>, <_virtualenv._Finder object at 0x0000018735A9DB80>, <class '_frozen_importlib.BuiltinImporter'>, <class '_frozen_importlib.FrozenImporter'>, <class '_frozen_importlib_external.PathFinder'>]
# checking imports -> verified ok
# checking thespian internal system imports -> verified ok
# checking existing running actors was skipped - please install psutils python package to support this
# checking hostname -> verified ok
# checking fqdn -> verified ok
# checking addr info proto=UDP desc=default usage=0 -> verified ok
# checking addr info proto=UDP desc=default usage=passive -> verified ok
# checking addr info addr=P340 proto=UDP desc=hostname usage=0 -> verified ok
# checking addr info addr=P340 proto=UDP desc=hostname usage=passive -> verified ok
# checking addr info addr=P340.fritz.box proto=UDP desc=fqdn usage=0 -> verified ok
# checking addr info addr=P340.fritz.box proto=UDP desc=fqdn usage=passive -> verified ok
# checking addr info proto=TCP desc=default usage=0 -> verified ok
# checking addr info proto=TCP desc=default usage=passive -> verified ok
# checking addr info addr=P340 proto=TCP desc=hostname usage=0 -> verified ok
# checking addr info addr=P340 proto=TCP desc=hostname usage=passive -> verified ok
# checking addr info addr=P340.fritz.box proto=TCP desc=fqdn usage=0 -> verified ok
# checking addr info addr=P340.fritz.box proto=TCP desc=fqdn usage=passive -> verified ok
# checking IP addresses ... Got 10 IP addresses

    None
    172.31.192.1
    192.168.178.77
    127.0.0.1
    localhost
    192.168.178.27
    172.29.176.1
    172.25.16.1
    0.0.0.0
# checking IP addresses -> verified ok
# checking AdminPort available base=multiprocUDPBase port=1029 -> verified ok
# checking AdminPort available base=multiprocTCPBase port=1900 -> verified ok
# checking socket communications proto=UDP port=1029 -> verified ok
# checking socket communications proto=TCP port=1900 ... Exception in thread TCPclient:

Traceback (most recent call last):
  File "C:\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\wfunk\source\repos\Thespian\thespian\diagnose.py", line 343, in run
    self.test_socket(af, proto)
  File "C:\Users\wfunk\source\repos\Thespian\thespian\diagnose.py", line 393, in test_socket
    r = s.recv(1024)
        ^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] Eine vorhandene Verbindung wurde vom Remotehost geschlossen
   [......server] : did not register successful completion
   [......client] : did not register successful completion
# checking socket communications proto=TCP port=1900 has FAILED
-> verified ok
# checking simple actors base=simpleSystemBase ...    [Unexpected output] : b'Hello, world!\r\nGoodbye\r\n'
# checking simple actors base=simpleSystemBase has FAILED

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\wfunk\source\repos\Thespian\thespian\diagnose.py", line 439, in <module>
    d.check_simple_actors(True, 'simpleSystemBase')
  File "C:\Users\wfunk\source\repos\Thespian\thespian\diagnose.py", line 99, in wrap
    rval = op(self, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wfunk\source\repos\Thespian\thespian\diagnose.py", line 330, in check_simple_actors
    assert o == exp_o
AssertionError

--- End of script output ---

I should note that everything is fine when running on the same machine under WSL with Ubuntu 22.04 (and on my dedicated Ubuntu 22.04 machine anyway).

Regards,
Wolfgang

P.S.: In line 29 of your script I had to change SetconsoleMode to SetConsoleMode (uppercase C) for running on Windows.

Kevin Quick

unread,
Feb 14, 2024, 12:59:30 PM2/14/24
to Wolfgang Funk, thespian.py
Hi Wolfgang,

Thanks for the note about the mis-spelled windows function call. I've
fixed and pushed patches to deal with that and the different line
endings causing the failures on the simple system tests.

The s.recv failure for TCP is the concerning issue here. It indicates
that the connection attempt to that port is getting forcibly closed,
either by whatever might be running at that port, or by some system
monitoring. A couple of lines up from that failure I see `# checking
AdminPort available base=multiprocTCPBase port=1900 -> verified ok`,
which indicates that we were able to successfully bind a server to
that port, which implies there is nothing else running at that port
although the generated thespian_diagnostics.log will have more
information about the startup of the client/server tests on that port.

Without knowing the additional details in the diagnostics logfile it
looks like this is probably the latter effect: forcible shutdown by
some system monitoring. The likely conclusion here is firewalling or
virus scanning (see also
https://windowsreport.com/winsock-error-10054/), although it is worth
noting that port 1900 may be "reserved" in your Windows system (try
`netsh int ipv4 show excludedportrange protocol=tcp`). One option is
using a different port number for the multiprocTCPBase by setting the
"Admin Port" capability as described here:
https://thespianpy.com/doc/using.html#hH-9d33a877-b4f0-4012-9510-442d81b0837c

-Kevin

On Wed, Feb 14, 2024 at 4:07 AM 'Wolfgang Funk' via thespian.py
> To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/754281ef-984c-47a7-8a46-b22dbb2e27a4n%40googlegroups.com.



--
-KQ
Reply all
Reply to author
Forward
0 new messages