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

[GDS] StandardPipeline not correctly disconnected: 50050: Address already in use #2520

Closed
thomas-bc opened this issue Feb 7, 2024 Discussed in #2519 · 3 comments
Closed
Assignees
Labels
bug F´ GDS Issues pertaining to the F´ GDS

Comments

@thomas-bc
Copy link
Collaborator

Discussed in #2519

Originally posted by SMorettini February 7, 2024
Since I started using fprime-gds, I've encountered the following error when starting it multiple times in a row:

[ERROR] Error with address/port '0.0.0.0:50050' : [Errno 98] Address already in use

This error doesn't occur every time but it seems to happen at least one out of ten times. My usual workaround is to change the --tts-port.

Upon investigation today, I found out what I suspected to be the problem. In flask/app.py, a pipeline is created but the disconnect method is never called. I attempted to add the call to disconnect but couldn't find a way to do so.

The pipeline is created only once when starting fprime-gds. Any request uses the same pipeline object. As far as I understand, Flask doesn't support the design of using the same object across all API requests. According to Flask's suggested design, each API function should create a new connection to the TCPServer. Therefore, Flask doesn't provide a way to register a function to clean up or teardown a global object.

I tried to register a signal_handler but it seems that Flask gives very little time for any signal handling, forcing the server to close too quickly and not allowing the disconnect method to complete execution.

Has anyone else encountered the Address already in use error? How did you solve it? Any ideas on how we could change fprime-gds to close more cleanly?

@thomas-bc thomas-bc added bug F´ GDS Issues pertaining to the F´ GDS labels Feb 7, 2024
@zimri-leisher
Copy link
Collaborator

Also experiencing this.

@thomas-bc
Copy link
Collaborator Author

thomas-bc commented Mar 18, 2024

The --zmq flag removes the need of a middleware application occupying port 50050, using ZMQ instead of a TCP server being the middleman. We will probably make --zmq flag the default, removing this issue altogether.

Until a GDS release comes out, fprime-gds --zmq --zmq-server should work. Not using --zmq-server results in the bug in the current GDS version

@LeStarch
Copy link
Collaborator

Make zmq the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug F´ GDS Issues pertaining to the F´ GDS
Projects
None yet
Development

No branches or pull requests

3 participants