Repository navigation
QUIC: QuicListener not reporting address in use correctly #73045
Description
Activity
- ghost addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Jul 29, 2022 The error originates from MsQuic from here:
https://github.com/microsoft/msquic/blob/main/src/core/listener.c#L338
We should probably check with MsQuic team.
BindAsync_ListenersSharePort_ThrowAddressInUsefailing on build server: https://dev.azure.com/dnceng/public/_build/results?buildId=1910981&view=ms.vss-test-web.build-test-results-tab&runId=49596722&resultId=109366&paneView=debugThe issue seems to be only in cases where you try to start two QUIC listeners on the same port with intersecting ALPN sets inside the same process. When the desired port is occupied by a different process or by a
Socketinstance, the call throws withQuicError.AddressInUseas expected.The problem with two QuicListeners in the same process is that MsQuic allows binding two listeners on the same port as long as they don't have conflicting ALPNs, so returning
AddressInUsemight be confusing because creating the listener with different ALPN would succeed.From a brief conversation with MsQuic team, some possible solutions are:
- Map the error to AddressInUse at the System.Net.Quic layer (not recommended by nibanks)
- Surface the error as "Address in use" at the HTTP layer (but other protocols implemented on top of S.N.Q will face the same issue)
- introduce another status code/ QuicError: "ALPN in use" which would make more clear what is going on.
Adding
QuicError.AlpnInUseto S.N.Q sounds the best. It would be nice if the exception message says which ALPN is in use, but it's not critical.In Kestrel, we'll probably still surface the error to the user that the port is already in use. With HTTP/3, the ALPN is always
h3.Triage: Limited to corner-case scenario - 2 QuicListener using the same port in the same process. Moving to Future.
- added and removeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Aug 2, 2022 When is the decision about future issues going into .NET 8?
I agree it's not common, but people do all kinds of crazy stuff in server apps. Having a clear error message when they mess this up would stop those people from getting stuck with an unhelpful error message.
Since it seems like there is no distinct error, we would need MsQuic changes to detect this reliably.
cc: @nibanks for more thoughts.I've got a PR written up that changes the return value to (a newly defined)
QUIC_STATUS_ALPN_IN_USE. But a problem I have with this is that it's an API behavior change. Strictly speaking, it's breaking, but I'm wondering if I can slip it through unnoticed.Reacted by Karel Zikmund@JamesNK to answer your earlier question -- we will start thinking systematically about 8.0 vs. Future in October the earliest.
Reacted by James Newton-King- ghost addedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on Aug 29, 2022 - ghost removedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on Sep 30, 2022 - ghost locked as resolved and limited conversation to collaborators
on Oct 30, 2022
Description
When two listeners are started on the same port, I get a generic error message instead of the address in use.
Note: this is on my local dev machine. I've seen S.N.Q report the right error message, e.g. dotnet/aspnetcore#42967
Reproduction Steps
See the unit test
BindAsync_ListenersSharePort_ThrowAddressInUseadded in dotnet/aspnetcore#42983Expected behavior
QuicExceptionhas a status ofAddressInUseand a friendly error message.Actual behavior
ListenAsync throws this error:
System.Net.Quic.QuicException : An internal error has occurred. ListenerStart failed: QUIC_STATUS_INVALID_STATESomeone who gets that error message will have no idea what the problem is or how to fix it.
Full logs:
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response