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

ERROR [__main__] A JuicePass Proxy task failed: ValueError: reuse_port not supported by socket module (run on Windows) #86

Open
BstNst99 opened this issue Sep 10, 2024 · 5 comments

Comments

@BstNst99
Copy link

I run juicepassproxy on Windows. it will error by message,
ERROR [main] A JuicePass Proxy task failed: ValueError: reuse_port not supported by socket module

cause of reuse_port not compatible with Windows.

I just fix problem by edit line 83 of juicebox_mitm.py to from "reuse_port=True" to "reuse_port=False". It work correctly.

@FalconFour
Copy link

Awesome find. My setup just did the same thing when I tried setting it up:

2024-10-04 22:22:23  ERROR     [__main__] A JuicePass Proxy task failed: ValueError: reuse_port not supported by socket module
Traceback (most recent call last):
  File "C:\Users\micro\Desktop\juicepassproxy-juicebox_commands\juicepassproxy.py", line 565, in main
    await asyncio.gather(
  File "C:\Users\micro\Desktop\juicepassproxy-juicebox_commands\juicebox_mitm.py", line 59, in start
    await self._connect()
  File "C:\Users\micro\Desktop\juicepassproxy-juicebox_commands\juicebox_mitm.py", line 87, in _connect
    self._dgram = await asyncio_dgram.bind(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\AppData\Local\Programs\Python\Python312\Lib\site-packages\asyncio_dgram\aio.py", line 244, in bind
    transport, protocol = await loop.create_datagram_endpoint(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1399, in create_datagram_endpoint
    _set_reuseport(sock)
  File "C:\Users\micro\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 92, in _set_reuseport
    raise ValueError('reuse_port not supported by socket module')
ValueError: reuse_port not supported by socket module

Possibly an issue of little consequence since the target system is Linux (within Home Assistant), but for debug testing on a separate machine, this could be fixed to make life easier.

@BstNst99
Copy link
Author

BstNst99 commented Oct 6, 2024

Now. I change more to support Windows and can run as long service.

  1. edit line 78 and 83 of juicebox_mitm.py to from "reuse_port=True" to "reuse_port=False".
  2. change line 26 of const.py from MAX_JPP_LOOP = 10 to MAX_JPP_LOOP = 999999 to protect proxy about when XWaybox temporary offline

@FalconFour
Copy link

FalconFour commented Oct 11, 2024

FWIW, whenever I pull the latest commit, the first/only thing I have to change is "reuse_port=False" in two lines. There's a tradeoff in making that second (unrelated) change - it's likely meant as a safeguard against the software becoming unstable, but it does indeed have the effect of "crashing" if the box is ever offline (which mine is, unplugged 99% of the time because I'm a giant nerd always powering the JuiceBox using weird batteries and cords - I usually charge at work, ha).

@ivanfmartinez
Copy link
Contributor

@FalconFour please check the last commit which has a option to select on command line or configuration file

@ivanfmartinez
Copy link
Contributor

best will be if someone can detect the environment to select correct default on windows

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

3 participants