Skip to content

Conversation

@MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Dec 10, 2025

Log the original bind exception when encountering Failed to listen on 0.0.0.0, continuing because listening on [::]

Before:

WARNING - call_when_running - Failed to listen on 0.0.0.0, continuing because listening on [::]

After:

WARNING - call_when_running - Failed to listen on 0.0.0.0, continuing because listening on [::]. Original exception: CannotListenError: Couldn't listen on 0.0.0.0:8008: [Errno 98] Address already in use.

Spawning from @gaelgatelement encountering this error and seeing that :: is not actually binding to both IPv4 and IPv6 as this comment suggests. While this PR doesn't change or fix that, this just gives us more insight and context when we see the warning:

Binding on both 0.0.0.0 and :: causes an exception on Linux and macOS
because :: binds on both IPv4 and IPv6 (as per RFC 3493).
When binding on 0.0.0.0 after :: this can safely be ignored.

Testing strategy

  1. Edit your homeserver config (homeserver.yaml) to bind both :: and 0.0.0.0
    listeners:
      - port: 8008
        bind_addresses: [
          '::',
          '0.0.0.0'
        ]
        # ...
  2. Start Synapse: poetry run synapse_homeserver --config-path homeserver.yaml
  3. Notice the warning in your homeserver logs (homeserver.log), WARNING - call_when_running - Failed to listen on 0.0.0.0, continuing because listening on [::]

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

@MadLittleMods MadLittleMods marked this pull request as ready for review December 10, 2025 17:26
@MadLittleMods MadLittleMods requested a review from a team as a code owner December 10, 2025 17:26
@MadLittleMods MadLittleMods merged commit 41938d6 into develop Dec 19, 2025
78 of 80 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/see-origin-bind-exception branch December 19, 2025 20:29
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @devonh 🐝

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

Successfully merging this pull request may close these issues.

3 participants