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

Don't automatically fall back to automatic port if web socket port is already in use, only recommend using 0 instead #6296

Merged
merged 1 commit into from
May 13, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented May 13, 2024

What

Running this scrip twice:

#!/usr/bin/env python3
import rerun as rr
import time

def main() -> None:
    rr.init("rerun_example_serve")
    rr.serve(web_port=57158, ws_port=57159)

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        print("Ctrl-C received. Exiting.")

if __name__ == "__main__":
    main()

Gives now this error:

Traceback (most recent call last):
  File "/Users/andreas/dev/rerun-io/rerun/test.py", line 18, in <module>
    main()
  File "/Users/andreas/dev/rerun-io/rerun/test.py", line 8, in main
    rr.serve(web_port=57158, ws_port=57159)
  File "/Users/andreas/dev/rerun-io/rerun/rerun_py/rerun_sdk/rerun/sinks.py", line 252, in serve
    bindings.serve(
RuntimeError: Failed to bind to WebSocket port 57159 since the address is already in use. Use port 0 to let the OS choose a free port.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@Wumpf Wumpf added 🪳 bug Something isn't working include in changelog labels May 13, 2024
@Wumpf Wumpf merged commit de3078c into main May 13, 2024
36 checks passed
@Wumpf Wumpf deleted the andreas/fix-unvoluntary-port-reuse branch May 13, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using rr.serve and specifying ports, they are chosen at random if they are already occupied.
2 participants