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

Error when attempting to bind on address ::1 #97

Closed
robintw opened this issue Dec 3, 2021 · 3 comments · Fixed by #98
Closed

Error when attempting to bind on address ::1 #97

robintw opened this issue Dec 3, 2021 · 3 comments · Fixed by #98
Labels
needs-future-test Add a test for this in the future, once tests exist (#26)

Comments

@robintw
Copy link
Contributor

robintw commented Dec 3, 2021

I'm running stackstac from a Jupyter instance running inside a docker container. When calling stackstac.show I get the following error:

/srv/conda/envs/notebook/lib/python3.8/site-packages/stackstac/show.py:484: UserWarning: Calculating 2nd and 98th percentile of the entire array, since no range was given. This could be expensive!
  warnings.warn(
tornado.application - ERROR - Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <zmq.eventloop.ioloop.ZMQIOLoop object at 0x7f6c083fabe0>>, <Task finished name='Task-51' coro=<_launch_server.<locals>.run() done, defined at /srv/conda/envs/notebook/lib/python3.8/site-packages/stackstac/show.py:847> exception=OSError(99, "error while attempting to bind on address ('::1', 8000, 0, 0): cannot assign requested address")>)
Traceback (most recent call last):
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/tornado/ioloop.py", line 741, in _run_callback
    ret = callback()
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/tornado/ioloop.py", line 765, in _discard_future_result
    future.result()
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/stackstac/show.py", line 858, in run
    await site.start()
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/aiohttp/web_runner.py", line 121, in start
    self._server = await loop.create_server(
  File "/srv/conda/envs/notebook/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 99] error while attempting to bind on address ('::1', 8000, 0, 0): cannot assign requested address

It looks like it is failing to bind to the address ::1 (which looks like it is the IPv6 version of 127.0.0.1). Following the stackstac code, I found https://github.com/gjoseph92/stackstac/blob/main/stackstac/show.py#L857 where the server is started on localhost, which is presumably converted to ::1 somewhere inside the server hosting code.

I found a few other issues on Github that seem to be very similar, for other applications - eg. here. This links to an aiohttp issue here which I can't quite work out if it has been fixed or not.

Anyway, the solution suggested on these issues seems to be forcing the binding address to be either 0.0.0.0 or 127.0.0.1. Changing localhost to either of these at https://github.com/gjoseph92/stackstac/blob/main/stackstac/show.py#L857 - though I must admit I can't really understand why localhost doesn't work.

Do you have any deeper understanding of this? If not, would you be happy with me submitting a PR to change to either 0.0.0.0 or 127.0.0.1?

@gjoseph92
Copy link
Owner

Yeah, I discovered this a few days ago. I was really hoping it wouldn't be related to your problem, but had a feeling it was. Sorry I didn't mention it and you had to go debugging too.

I already have a fix for it 2d2781e in a somewhat long-running branch. I should probably just merge this branch, but if it would help you to get the change in faster, please feel free to open a PR with just this change and I'll merge it right away.

@gjoseph92
Copy link
Owner

Also does this fix #96?

@robintw
Copy link
Contributor Author

robintw commented Dec 3, 2021

Thanks @gjoseph92. I'll probably make a small PR on Monday just to make it easier to get the fix in place across the various places I use stackstac.

Unfortunately this doesn't fix #96, it seems to be entirely independent of it. Also, when running in my Docker container, I'm getting a bug that is similar to #96 but not quite the same - in this case the checkerboard pattern is appearing, but the data isn't appearing. I'll post more details either in #96 or a separate issue next week.

@gjoseph92 gjoseph92 added needs-future-test Add a test for this in the future, once tests exist (#26) and removed needs-future-test Add a test for this in the future, once tests exist (#26) labels Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-future-test Add a test for this in the future, once tests exist (#26)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants