Closed elias-a closed 8 months ago
Hi @mwcraig, I ran into an issue with re-running a vpython script - after closing the browser or exiting the program via Ctrl-C, I’m not able to successfully run the script again for a few tens of seconds. The issue appears to be that the TCP connection remains open for a period TIME_WAIT, preventing a new connection from being made on the same port when I run the program again. Setting the SO_REUSEADDR option overrides this default behavior and allows a connection on the same port even while in the TIME_WAIT state. Here’s the traceback I get:
Traceback (most recent call last): File "/Users/elias-a/projects/vpython-test/run.py", line 4, in <module> box(length=1, height=1, width=1) File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/vpython.py", line 1183, in __init__ super(box, self).setup(args) File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/vpython.py", line 612, in setup super(standardAttributes, self).__init__() File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/vpython.py", line 267, in __init__ from .no_notebook import _ File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/no_notebook.py", line 66, in <module> __HTTP_PORT = find_free_port(4200) ^^^^^^^^^^^^^^^^^^^^ File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/no_notebook.py", line 63, in find_free_port s.bind(('', port)) OSError: [Errno 48] Address already in use Exception ignored in: <function standardAttributes.__del__ at 0x110149440> Traceback (most recent call last): File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/vpython.py", line 1176, in __del__ super(standardAttributes, self).__del__() File "/Users/elias-a/projects/vpython-test/venv/src/vpython/vpython/vpython.py", line 348, in __del__ cmd = {"cmd": "delete", "idx": self.idx} ^^^^^^^^ AttributeError: 'box' object has no attribute 'idx'
Thanks @elias-a -- could you please add yourself to the list of contributors at CONTRIBUTORS.md?
Done. Thanks @mwcraig
Thanks, @elias-a!
Thanks for opening this @elias-a -- what problem is this fixing? I have top admit I'm not super familiar with the web socket pieces of vpython...