Wrong IP addresses registered when using Docker overlay network
@mattjala is already working on this.
Since Aug 25, 2026.
Assessment
This issue has not been assessed yet.
Description
Using 170: peername = request.transport.get_extra_info('peername') in headnode.py fetches the node IP of the overlay network, and not the IP of the registering service/data node.
I replaced line 170 with a few lines of code into the register function to accept an 'addr' field from the registering node:
if 'addr' not in body:
peername = request.transport.get_extra_info('peername')
if peername is None:
raise HTTPBadRequest(reason="Can not determine caller IP")
elif len(body['addr']) == 2:
peername = body['addr']
else:
raise HTTPBadRequest(reason="Can not determine caller IP")
and I added the following function to basenode.py to be invoked while sending the register signal:
def getNodeIp(node_type):
""" Gets IP of local host (container) for the default route """
log.info("Node type: %s" % node_type)
if node_type == 'sn':
if config.get("sn_port"):
port = config.get("sn_port")
elif node_type == 'dn':
if config.get("dn_port"):
port = config.get("dn_port")
else:
port = 6101
IP = ((([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")] or [[(s.connect(("8.8.8.8", 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) + ["no IP found"])[0], port)
log.info("sending node ip: %s:%s" % IP)
return IP
async def register(app):
""" register node with headnode
OK to call idempotently (e.g. if the headnode seems to have forgotten us)"""
head_url = getHeadUrl(app)
if not head_url:
log.warn("head_url is not set, can not register yet")
return
req_reg = head_url + "/register"
log.info("register: {}".format(req_reg))
addr = getNodeIp(app["node_type"])
if addr:
body = {"id": app["id"], "port": app["node_port"], "node_type": app["node_type"], "addr": addr}
else:
body = {"id": app["id"], "port": app["node_port"], "node_type": app["node_type"]}
.... etc
- Dominant language
- Python
- Stars
- 158
- Forks
- 61
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 6
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HDFGroup/hsds
-
Links orderMay be free again @mattjala claimed this 79 days ago, and no pull request is open. Openquestion
-
codespace starts with config complaint, can't run testall.pyMay be free again @mattjala claimed this 79 days ago, and no pull request is open. Openbug
-
How to use config.ymlMay be free again @mattjala claimed this 79 days ago, and no pull request is open. Openbug
-
HSDS azure kubernetes lockupMay be free again @mattjala claimed this 79 days ago, and no pull request is open. Openbug
-
Support HEAD requests for dataset selectionMay be free again @mattjala claimed this 79 days ago, and no pull request is open. Openenhancement
Similar issues
-
AI bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
btclib-org/btclib-wallet#872 ·
Maintainers usually reply within 1 day
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme loadPossibly taken A pull request linked to this issue is open or already merged. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
saltstack/salt#70789 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
btclib-org/btclib#3093 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day