Skip to content

[Threadless] OSError: [WinError 10038] an operation was attempted on something that is not a socket #492

Open
@lubosmato

Description

@lubosmato

Describe the bug
When starting proxy.py in threadless mode on Windows, OS error is raised. Threaded mode works fine.

Here is a stack trace:
(num workers option is specified only to see the error just once, it occurs on all workers and floods stdout)

C:\>python -m proxy --threadless --num-workers 1
2021-01-28 07:43:24,739 - pid:5480 [I] load_plugins:334 - Loaded plugin proxy.http.proxy.HttpProxyPlugin
2021-01-28 07:43:24,740 - pid:5480 [I] listen:113 - Listening on ::1:8899
2021-01-28 07:43:24,744 - pid:5480 [I] start_workers:136 - Started 1 workers
Process Threadless-1:1:
Traceback (most recent call last):
  File "D:\Python38\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "D:\Python38\lib\site-packages\proxy\core\acceptor\threadless.py", line 175, in run
    self.run_once()
  File "D:\Python38\lib\site-packages\proxy\core\acceptor\threadless.py", line 146, in run_once
    with self.selected_events() as (readables, writables):
  File "D:\Python38\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "D:\Python38\lib\site-packages\proxy\core\acceptor\threadless.py", line 73, in selected_events
    ev = self.selector.select(timeout=1)
  File "D:\Python38\lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "D:\Python38\lib\selectors.py", line 314, in _select
    r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] an operation was attempted on something that is not a socket

I couldn't reproduce it on WSL so I assume this is only Windows problem.

To Reproduce
Steps to reproduce the behavior:

  1. Run python -m proxy --threadless on Windows
  2. See the error

Expected behavior
Proxy shouldn't raise this error I guess.

Version information

  • OS: Windows:
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19041 N/A Build 19041
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Processor(s):              1 Processor(s) Installed.
                           [01]: AMD64 Family 23 Model 113 Stepping 0 AuthenticAMD ~3893 Mhz
BIOS Version:              American Megatrends Inc. F2, 7. 7. 2020
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             cs;Čeština
Input Locale:              cs;Čeština
Time Zone:                 (UTC+01:00) Praha, Bratislava, Budapešť, Bělehrad, Lublaň
Total Physical Memory:     65 482 MB
Available Physical Memory: 48 516 MB
Virtual Memory: Max Size:  75 210 MB
Virtual Memory: Available: 54 568 MB
Virtual Memory: In Use:    20 642 MB
Hotfix(s):                 10 Hotfix(s) Installed.
                           [01]: KB4586876
                           [02]: KB4561600
                           [03]: KB4570334
                           [04]: KB4577266
                           [05]: KB4580325
                           [06]: KB4584229
                           [07]: KB4586864
                           [08]: KB4593175
                           [09]: KB4598481
                           [10]: KB4598242
Network Card(s):           4 NIC(s) Installed.
                           [01]: Realtek Gaming 2.5GbE Family Controller
                                 Connection Name: Ethernet
                                 DHCP Enabled:    Yes
                                 DHCP Server:     192.168.0.1
                                 IP address(es)
                                 [01]: 192.168.0.109
                                 [02]: xxxxx
                           [02]: Intel(R) Dual Band Wireless-AC 3168
                                 Connection Name: Wi-Fi
                                 Status:          Media disconnected
                           [03]: Bluetooth Device (Personal Area Network)
                                 Connection Name: Síťové připojení Bluetooth
                                 Status:          Media disconnected
                           [04]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (WSL)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.31.160.1
                                 [02]: xxxxx
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.    
  • Python: Python 3.8.5 x64
  • proxy.py: 2.3.1

Additional context
Running proxy.py in WSL is without any problem.

mato@mato-pc:/mnt/c/Windows/system32$ python3 --version
Python 3.8.5
mato@mato-pc:/mnt/c/Windows/system32$ pip3 list | grep proxy.py
proxy.py               2.3.1
mato@mato-pc:/mnt/c/Windows/system32$ python3 -m proxy --threadless
2021-01-28 07:53:20,437 - pid:84 [I] load_plugins:334 - Loaded plugin proxy.http.proxy.HttpProxyPlugin
2021-01-28 07:53:20,437 - pid:84 [I] listen:113 - Listening on ::1:8899
2021-01-28 07:53:20,447 - pid:84 [I] start_workers:136 - Started 16 workers

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug report in proxy serverWindowsIssues found only on Windows OS

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions