Skip to content

moto server port conflicts on macOS #291

Description

@kevinjqliu

Apache Iceberg version

None

Please describe the bug 🐞

Moto server is used to mock S3 client calls

MacOS uses port 5000 for AirPlay Receiver which causes port conflict with moto_server used for s3 tests [0][1]

Furthermore, the ThreadedMotoServer implementation kicks off a thread to bind to port 5000. The thread silently errors out when there is a port conflict, but moto server will still assume that port is available.

The tests assume that moto server is available and sends requests. The tests error out with ClientError which is confusing.

poetry run pytest tests/catalog/test_dynamodb.py -k test_create_dynamodb_catalog_with_table_name
Screenshot 2024-01-21 at 12 53 33 PM

Possible solution:

  1. Manually turn off AirPlay to free up port 5000
  2. Use another default port (such as 5001)
  3. Check if the port is available before starting the moto server [2]
  4. Do (2) and (3)

[0] https://stackoverflow.com/questions/69955686/why-cant-i-run-the-project-on-port-5000
[1] amundsen-io/amundsen#1813
[2] https://stackoverflow.com/questions/2470971/fast-way-to-test-if-a-port-is-in-use-using-python

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