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

Flask server address error #7

Open
kcpevey opened this issue Jul 15, 2019 · 2 comments
Open

Flask server address error #7

kcpevey opened this issue Jul 15, 2019 · 2 comments

Comments

@kcpevey
Copy link

kcpevey commented Jul 15, 2019

If I have a notebook that is attempting to run/authenticate uit, and I open up a second notebook, I will get the following error. Might want to consider randomizing the flask server address to avoid this error:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-b1a9d2b782d4> in <module>
----> 1 c.authenticate(notebook=True)

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in authenticate(self, notebook, width, height, callback)
    199 
    200         # start flask server
--> 201         start_server(self.get_token, self.config_file)
    202 
    203         auth_url = self.get_auth_url()

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in start_server(auth_func, config_file)
    619 def start_server(auth_func, config_file):
    620     app = Flask('get_uit_token')
--> 621     server = ServerThread(app)
    622     server.start()
    623 

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in __init__(self, app)
    606     def __init__(self, app):
    607         threading.Thread.__init__(self)
--> 608         self.srv = make_server('127.0.0.1', 5000, app)
    609         self.ctx = app.app_context()
    610         self.ctx.push()

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/werkzeug/serving.py in make_server(host, port, app, threaded, processes, request_handler, passthrough_errors, ssl_context, fd)
    818     else:
    819         return BaseWSGIServer(
--> 820             host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
    821         )
    822 

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/werkzeug/serving.py in __init__(self, host, port, app, handler, passthrough_errors, ssl_context, fd)
    696         if self.address_family == af_unix and os.path.exists(server_address):
    697             os.unlink(server_address)
--> 698         HTTPServer.__init__(self, server_address, handler)
    699 
    700         self.app = app

~/miniconda3/envs/adhui0715/lib/python3.6/socketserver.py in __init__(self, server_address, RequestHandlerClass, bind_and_activate)
    451         if bind_and_activate:
    452             try:
--> 453                 self.server_bind()
    454                 self.server_activate()
    455             except:

~/miniconda3/envs/adhui0715/lib/python3.6/http/server.py in server_bind(self)
    134     def server_bind(self):
    135         """Override server_bind to store the server name."""
--> 136         socketserver.TCPServer.server_bind(self)
    137         host, port = self.server_address[:2]
    138         self.server_name = socket.getfqdn(host)

~/miniconda3/envs/adhui0715/lib/python3.6/socketserver.py in server_bind(self)
    465         if self.allow_reuse_address:
    466             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
--> 467         self.socket.bind(self.server_address)
    468         self.server_address = self.socket.getsockname()
    469 

OSError: [Errno 48] Address already in use
@sdc50
Copy link
Member

sdc50 commented Jul 16, 2019

I actually had implemented this at one point, but the problem is that the UIT+ settings have to have a callback URL which specifies the port, so the Flask server can be started on a random port, but then it won't receive the UIT+ callback with the token. I haven't worked out a great solution for this issue yet.

@thecraftman
Copy link

Try implementing this feature on ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants