Skip to content

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

@TAlonglong

Description

@TAlonglong

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions