This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jcristharif
Recipients asvetlov, eric.smith, jcristharif, yselivanov
Date 2021-11-03.11:57:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635940629.57.0.345549634473.issue45693@roundup.psfhosted.org>
In-reply-to
Content
> I'm not aware of an OS API call that binds both IPv4 and IPv6 to the same random port.

Sure, but `loop.create_server` is already higher-level than a single OS API call. 

By default `create_server` will already bind multiple sockets if `host=""`, `host=None`, or if `host` is a list. I'm arguing that the current behavior with `port=0` in these situations is unexpected. Other libraries (like tornado) have come to the same conclusion, and have implemented logic to handle this that seems to work well in practice (though can fail, as you've pointed out).

Is there a use case where the current behavior (binding to multiple random ports) is desired?
History
Date User Action Args
2021-11-03 11:57:09jcristharifsetrecipients: + jcristharif, eric.smith, asvetlov, yselivanov
2021-11-03 11:57:09jcristharifsetmessageid: <1635940629.57.0.345549634473.issue45693@roundup.psfhosted.org>
2021-11-03 11:57:09jcristhariflinkissue45693 messages
2021-11-03 11:57:09jcristharifcreate