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

macOS: Network configuration changed from 11 to 12 and later #9534

Closed
6 of 13 tasks
jan-janssen opened this issue Mar 19, 2024 · 2 comments
Closed
6 of 13 tasks

macOS: Network configuration changed from 11 to 12 and later #9534

jan-janssen opened this issue Mar 19, 2024 · 2 comments
Labels
bug report duplicate This issue or pull request already exists OS: macOS

Comments

@jan-janssen
Copy link

Description

In macOS 11 it was possible to connect to the current CI runner via the hostname of the CI runner. Starting in macOS 12 it is only possible to connect to localhost but the resolution of the hostname to point to the same IP address like localhost does not work any longer. I have a simple example using python and zmq: https://github.com/jan-janssen/macOS-hostname-ci-debug

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20240218.1

Is it regression?

20240127.1

Expected behavior

The hostname should be resolved to the same address like localhost and the CI runner should allow connecting to this address.

Actual behavior

While connecting to localhost works, connecting via the hostname does not.

Repro steps

Simple python example:

# From: https://zeromq.org/languages/python/

from threading import Thread

import zmq


def client_reply(host, port):
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    socket.connect("tcp://" + host + ":" + port)
    message = socket.recv()
    socket.send(b"Client received: " + message)


if __name__ == "__main__":
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    port = socket.bind_to_random_port("tcp://*")
    process = Thread(target=client_reply, kwargs={"host": "localhost", "port": str(port)})
    process.start()
    socket.send(b"Hello")
    assert socket.recv().decode() == "Client received: Hello"

While the example above works, it breaks when connecting via the hostname:

# From: https://zeromq.org/languages/python/

from socket import gethostname
from threading import Thread

import zmq


def client_reply(host, port):
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    socket.connect("tcp://" + host + ":" + port)
    message = socket.recv()
    socket.send(b"Client received: " + message)


if __name__ == "__main__":
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    port = socket.bind_to_random_port("tcp://*")
    process = Thread(target=client_reply, kwargs={"host": gethostname(), "port": str(port)})
    process.start()
    socket.send(b"Hello")
    assert socket.recv().decode() == "Client received: Hello"

The only difference is connecting to tcp://localhost:<port> vs. tcp://<hostname>:<port>.

@Alexey-Ayupov
Copy link
Collaborator

Hello @jan-janssen. Your issue looks like duplicate of this one #8649. I will close this issue, please follow the progress of #8649 issue.
If you have any other questions feel free to reach us.

@oliver-sanders
Copy link

Yes, that sounds like the same issue. I also maintain a Python application that uses ZMQ, we have pinned our CI to macos-11 to work around the issue. There is a partial workaround on the linked issue, I think it should be enough to get your example working again, but it doesn't fix the underlying DNS setup issue so, like us you may get issues with functional tests.

@Alexey-Ayupov, do you know how long the macos-11 runners will be available for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report duplicate This issue or pull request already exists OS: macOS
Projects
None yet
Development

No branches or pull requests

3 participants