Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check if another process is already listening on the port before tryi…
…ng to spawn (#3501) ### What - Resolves: #2551 Before we spawn, we now try connecting to the port to see if it's in use or not, allowing us to print a better error message and not waste time kicking off a subprocess that's just going to fail. Before: ``` $ python docs/code-examples/point3d_random.py Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/jleibs/rerun/rerun_py/rerun_sdk/rerun/__main__.py", line 16, in <module> main() File "/home/jleibs/rerun/rerun_py/rerun_sdk/rerun/__main__.py", line 12, in main exit(bindings.main(sys.argv)) RuntimeError: Failed to bind TCP address "0.0.0.0:9876". Another Rerun instance is probably running. Address already in use (os error 98) ``` After: ``` $ python docs/code-examples/point3d_random.py DEV ENVIRONMENT DETECTED! Re-importing rerun from: /home/jleibs/rerun/rerun_py/rerun_sdk Found existing process on port 9876. Trying to connect. ``` ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3501) (if applicable) - [PR Build Summary](https://build.rerun.io/pr/3501) - [Docs preview](https://rerun.io/preview/4c212d77d5ff82020b1df508dbdf5606c7bd8bad/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/4c212d77d5ff82020b1df508dbdf5606c7bd8bad/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
- Loading branch information