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

Nameserver is still running even if publisher fails to start #51

Open
TAlonglong opened this issue Feb 15, 2023 · 0 comments
Open

Nameserver is still running even if publisher fails to start #51

TAlonglong opened this issue Feb 15, 2023 · 0 comments

Comments

@TAlonglong
Copy link
Contributor

IF namserver is started when network is not available, the publisher seems to start but is not. Even if the publisher fails to start namserver is still running causing confusion since module can not connect to each other using info from nameserver.

[INFO: 2023-02-14 11:16:28 : posttroll.publisher] publisher started on port 16543
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/software/miniconda/envs/pytroll/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/software/miniconda/envs/pytroll/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/posttroll/address_receiver.py", line 176, in _run
    with Publish("address_receiver", self._port, ["addresses"],
  File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/posttroll/publisher.py", line 278, in __enter__
    return self.start()
  File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/posttroll/publisher.py", line 221, in start
    addr = ("tcp://" + str(get_own_ip()) + ":" +
  File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/posttroll/publisher.py", line 47, in get_own_ip
    sock.connect(("8.8.8.8", 80))
OSError: [Errno 101] Network is unreachable

A solution is to wrap https://github.com/pytroll/posttroll/blob/main/posttroll/address_receiver.py#L176-L215 in a try/except OSError and setting self._is_running() to False

That way after https://github.com/pytroll/posttroll/blob/main/posttroll/ns.py#L131-L134 can be added a check if not arec.is_running fail.

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

1 participant