kivy / kivy/oscpy

Delay between close() and reopening a server

Open
#43 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
114
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Hello,

I had a bug showing only when trying to reopen a server with the same IP (or changing from 0.0.0.0 to 127.0.0.1) and same port settings after a close() function.

The error message is that the port is already in use.
```
Traceback (most recent call last):
File "/home/hebus/.config/blender/2.80/scripts/addons/MOM/osc.py", line 107, in save_osc_port_in
bpy.ops.mom.refresh_osc()
File "/Graphisme/blender-2.80-linux-glibc217-x86_64/2.80/scripts/modules/bpy/ops.py", line 201, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
File "/home/hebus/.config/blender/2.80/scripts/addons/MOM/osc.py", line 140, in execute
osc_server.listen(address=ip, port=port, default=True)
File "/Graphisme/2.80_migration/MOM/oscpy/server.py", line 245, in listen
sock.bind(addr)
OSError: [Errno 98] Address already in use
```

The solution I found was to introduce a delay using:
`time.sleep(.01)`

10ms was the minimal value to avoid the issue.

Contributor guide

Open the contributing guide

Research direction

Start in oscpy/server.py at listen(), especially the bind call shown in the traceback. Reproduce closing and reopening a server with the same address and port, including the 0.0.0.0 to 127.0.0.1 case. Done means the server can be reopened reliably without the address-in-use error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.