Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start espgw/wsgw on Windows 7 64-bit #34

Closed
Anton-V-K opened this issue Oct 17, 2021 · 8 comments
Closed

Cannot start espgw/wsgw on Windows 7 64-bit #34

Anton-V-K opened this issue Oct 17, 2021 · 8 comments

Comments

@Anton-V-K
Copy link

Anton-V-K commented Oct 17, 2021

I'm unable to start espgw or wsgw on Windows 7 SP1 64-bit with Python 3.8.6 32-bit; backplane starts fine.

E:\Users\Anton>espgw
TelemetrixAIO Version: 1.7
Copyright (c) 2018-2020 Alan Yorinks All rights reserved.

Traceback (most recent call last):
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Program Files (x86)\Python38-32\Scripts\espgw.exe\__main__.py", line 7, in <module>
  File "c:\program files (x86)\python38-32\lib\site-packages\s3_extend\gateways\esp8266_gateway.py", line 392, in esp8266_gateway
    app = Esp8266Gateway(subscriber_list, **kw_options, event_loop=loop)
  File "c:\program files (x86)\python38-32\lib\site-packages\s3_extend\gateways\esp8266_gateway.py", line 73, in __init__
    super(Esp8266Gateway, self).__init__(subscriber_list=subscriber_list,
  File "c:\program files (x86)\python38-32\lib\site-packages\python_banyan\gateway_base_aio\gateway_base_aio.py", line 113, in __init__
    super(GatewayBaseAIO, self).__init__(back_plane_ip_address=back_plane_ip_address,
  File "c:\program files (x86)\python38-32\lib\site-packages\python_banyan\banyan_base_aio\banyan_base_aio.py", line 116, in __init__
    p = psutil.Process(pid)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 326, in __init__
    self._init(pid)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 354, in _init
    self.create_time()
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 710, in create_time
    self._create_time = self._proc.create_time()
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 671, in convert_oserror
    raise exc
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 933, in create_time
    user, system, created = cext.proc_times(self.pid)
OSError: [WinError 0] Операция успешно завершена: '(originated from OpenProcess)'
E:\Users\Anton>wsgw -i 9002
Traceback (most recent call last):
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Program Files (x86)\Python38-32\Scripts\wsgw.exe\__main__.py", line 7, in <module>
  File "c:\program files (x86)\python38-32\lib\site-packages\s3_extend\gateways\ws_gateway.py", line 282, in ws_gateway
    WsGateway(subscription_list, **kw_options, event_loop=loop)
  File "c:\program files (x86)\python38-32\lib\site-packages\s3_extend\gateways\ws_gateway.py", line 79, in __init__
    super(WsGateway, self).__init__(subscriber_list=subscription_list,
  File "c:\program files (x86)\python38-32\lib\site-packages\python_banyan\banyan_base_aio\banyan_base_aio.py", line 116, in __init__
    p = psutil.Process(pid)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 326, in __init__
    self._init(pid)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 354, in _init
    self.create_time()
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\__init__.py", line 710, in create_time
    self._create_time = self._proc.create_time()
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 671, in convert_oserror
    raise exc
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "c:\program files (x86)\python38-32\lib\site-packages\psutil\_pswindows.py", line 933, in create_time
    user, system, created = cext.proc_times(self.pid)
OSError: [WinError 0] Операция успешно завершена: '(originated from OpenProcess)'

The last line in both logs translates as Operation completed successfully.

Windows 7 Home Premium (Russian, 64-bit)
Version: 6.1.7601 Service Pack 1 Build 7601

Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32 bit (Intel)] on win32
@MrYsLab
Copy link
Owner

MrYsLab commented Oct 18, 2021

Microsoft support for Windows 7 officially ended back in January 2020. Therefore Windows 7 is not supported for this project.

@MrYsLab MrYsLab closed this as completed Oct 18, 2021
@Anton-V-K
Copy link
Author

Too bad you aren't going to support Windows 7, which is an optimal choice for an educational box on an old piece of hardware.

@Anton-V-K
Copy link
Author

Will these servers work in Windows 8.1 64-bit?

@MrYsLab
Copy link
Owner

MrYsLab commented Oct 24, 2021

I don't know since it was only tested using Win 10, but probably it will.

@Anton-V-K
Copy link
Author

Based on the hint from the closed issue #27 stating that everything works in Windows 7, I decided to try it one more time.
I've installed Python 3.8.10 on Windows 7 SP1 32-bit (inside VirtualBox), and to my surprise all servers (namely backplane, espgw, wsgw and monitor) were able to start. Then I tried to run s3e and it also works!
I'll try same setup on the 'real' Windows 7 and with hardware connection and with Scratch.

@Anton-V-K
Copy link
Author

Anton-V-K commented Oct 24, 2021

After playing with my Windows 7 systems I'm still puzzled about this issue: it happens only on one real Windows 7 64-bit, and everything works fine on a virtual Windows 7 32/64-bit.
I guess this problem is somehow related to psutil, and there is similar issue giampaolo/psutil#1770 which disappeared after installing Windows updates.
However both tested virtual Windows 7 32/64-bit have only 3 updates installed, while the real Windows has much more updates on it. Probably some Windows updates broke the behavior, and a newer update is needed (this Windows box doesn't have recieved automatic updates).
And there is another similar issue giampaolo/psutil#1937 which isn't resolved, and it happens on Windows 10.
On all systems the version of psutil is the same - 5.8.0:

...>pip freeze | findstr psutil
psutil==5.8.0

There is also closed bug giampaolo/psutil#1877 which has nice little test script to imitate the behavior, and it seems to be related to permissions violation (access denied or something like this).
Here is the rewritten fragment of BanyanBaseAIO.__init__ from banyan_base_aio.py to test the behavior:

import psutil
processName='backplane'

for pid in psutil.pids():
    print(pid)
    p = psutil.Process(pid)
    try:
        p_command = p.cmdline()
    # ignore these psutil exceptions
    except (psutil.AccessDenied, psutil.PermissionError, psutil.ZombieProcess):
        continue
    try:
        if any(processName in s for s in p_command):
            print(processName, pid) # found it!
        else:
            continue
    except UnicodeDecodeError:
        continue

This script reaches pid 4 (System process) and fails on one specific Windows 7 box.
In this case psutil doesn't throw the proper exception, so the script 'crashes'.

@MrYsLab
Copy link
Owner

MrYsLab commented Oct 24, 2021

Thanks for the info. Windows and python modules are sometimes challenging. Suppose the package requires some of its code to be compiled using Visual Studio. In that case, the code may not be compatible because the Windows Version and the Visual Studio version are not always compatible.

FYI - as of about a week ago, psutil is not Python 3.10 compatible on any OS. Eventually, they will update the module, and all should work.

I don't own Windows 7, 8, or 11, so it would be impossible for me to test issues on any of these Windows versions. Windows 10 will be supported for a while. None of my computers can currently support Windows 11. Hopefully, someone will figure out how one can run Windows 11 in a virtual machine without meeting all of their security requirements.

@Anton-V-K
Copy link
Author

I understand your concerns.
Let's wait until next version of psutil is released - most likely the bug will be fixed there (I'm referring to giampaolo/psutil#1887 and giampaolo/psutil#1904).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants