Skip to content

QUIC fails to work after upgrading libmsquic to latest version #105788

Closed

Description

@ShreyasZare

Description

The QuicConnection.IsSupported property returns false when libmsquic is upgraded to latest version 2.4.0 on Debian 12.6 (bookworm).

Reproduction Steps

Prepare a VM with Debian 12.6 (bookworm) and install libmsquic version 2.4.0 from Microsoft packages. Write a small console app to print to console response of QuicConnection.IsSupported property.

Expected behavior

The QuicConnection.IsSupported should return true when latest libmsquic is installed.

Actual behavior

The QuicConnection.IsSupported returns false when latest libmsquic is installed.

Regression?

Downgrading libmsquic to version 2.3.6 fixes this issue so seems like an issue only with version 2.4.0.

Known Workarounds

No response

Configuration

  • .NET 8.0.7 Runtime
  • Debian 12.6 (bookworm)
  • Observed on x64, not tested on other platforms.
  • Have received multiple feedback from different users so does not seem to be related to specific config.

Other information

No response

Activity

  1. dotnet-policy-service commented on Aug 1, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/ncl
    See info in area-owners.md if you want to be subscribed.

  2. huoyaoyuan commented on Aug 1, 2024

    @huoyaoyuan
    Member

    Has msquic released a 2.4.0 version? The latest version on releases or tags page is still 2.3.6.

    The msquic detection code is here:

    if (OperatingSystem.IsWindows())
    {
    // Windows ships msquic in the assembly directory.
    loaded = NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle);
    }
    else
    {
    // Non-Windows relies on the package being installed on the system and may include the version in its name
    loaded = NativeLibrary.TryLoad($"{Interop.Libraries.MsQuic}.{s_minMsQuicVersion.Major}", typeof(MsQuicApi).Assembly, null, out msQuicHandle) ||
    NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, null, out msQuicHandle);
    }
    if (!loaded)
    {
    // MsQuic library not loaded
    NotSupportedReason = $"Unable to load MsQuic library version '{s_minMsQuicVersion.Major}'.";
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Info(null, NotSupportedReason);
    }
    return;
    }
    MsQuicOpenVersion = (delegate* unmanaged[Cdecl]<uint, QUIC_API_TABLE**, int>)NativeLibrary.GetExport(msQuicHandle, nameof(MsQuicOpenVersion));
    MsQuicClose = (delegate* unmanaged[Cdecl]<QUIC_API_TABLE*, void>)NativeLibrary.GetExport(msQuicHandle, nameof(MsQuicClose));
    if (!TryOpenMsQuic(out QUIC_API_TABLE* apiTable, out int openStatus))
    {
    // Too low version of the library (likely pre-2.0)
    NotSupportedReason = $"MsQuicOpenVersion for version {s_minMsQuicVersion.Major} returned {openStatus} status code.";
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Info(null, NotSupportedReason);
    }
    return;
    }
    try
    {
    // Check version
    uint paramSize;
    int status;
    paramSize = 4 * sizeof(uint);
    uint* libVersion = stackalloc uint[4];
    status = apiTable->GetParam(null, QUIC_PARAM_GLOBAL_LIBRARY_VERSION, &paramSize, libVersion);
    if (StatusFailed(status))
    {
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Error(null, $"Cannot retrieve {nameof(QUIC_PARAM_GLOBAL_LIBRARY_VERSION)} from MsQuic library: '{status}'.");
    }
    return;
    }
    Version = new Version((int)libVersion[0], (int)libVersion[1], (int)libVersion[2], (int)libVersion[3]);
    paramSize = 64 * sizeof(sbyte);
    sbyte* libGitHash = stackalloc sbyte[64];
    status = apiTable->GetParam(null, QUIC_PARAM_GLOBAL_LIBRARY_GIT_HASH, &paramSize, libGitHash);
    if (StatusFailed(status))
    {
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Error(null, $"Cannot retrieve {nameof(QUIC_PARAM_GLOBAL_LIBRARY_GIT_HASH)} from MsQuic library: '{status}'.");
    }
    return;
    }
    string? gitHash = Marshal.PtrToStringUTF8((IntPtr)libGitHash);
    MsQuicLibraryVersion = $"{Interop.Libraries.MsQuic} {Version} ({gitHash})";
    if (Version < s_minMsQuicVersion)
    {
    NotSupportedReason = $"Incompatible MsQuic library version '{Version}', expecting higher than '{s_minMsQuicVersion}'.";
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Info(null, NotSupportedReason);
    }
    return;
    }
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Info(null, $"Loaded MsQuic library '{MsQuicLibraryVersion}'.");
    }
    // Assume SChannel is being used on windows and query for the actual provider from the library if querying is supported
    QUIC_TLS_PROVIDER provider = OperatingSystem.IsWindows() ? QUIC_TLS_PROVIDER.SCHANNEL : QUIC_TLS_PROVIDER.OPENSSL;
    paramSize = sizeof(QUIC_TLS_PROVIDER);
    apiTable->GetParam(null, QUIC_PARAM_GLOBAL_TLS_PROVIDER, &paramSize, &provider);
    UsesSChannelBackend = provider == QUIC_TLS_PROVIDER.SCHANNEL;
    if (UsesSChannelBackend)
    {
    // Implies windows platform, check TLS1.3 availability
    if (!IsWindowsVersionSupported())
    {
    NotSupportedReason = $"Current Windows version ({Environment.OSVersion}) is not supported by QUIC. Minimal supported version is {s_minWindowsVersion}.";
    if (NetEventSource.Log.IsEnabled())
    {
    NetEventSource.Info(null, NotSupportedReason);
    }
    return;
    }
    Tls13ServerMayBeDisabled = IsTls13Disabled(isServer: true);
    Tls13ClientMayBeDisabled = IsTls13Disabled(isServer: false);
    }
    IsQuicSupported = true;

    Basically it tries to load libmsquic.so.2 or libmsquic.so, then calls initialization. You can check network event source or manually replicate the steps to identify which step is failing.

  3. ShreyasZare commented on Aug 1, 2024

    @ShreyasZare
    Author

    Has msquic released a 2.4.0 version? The latest version on releases or tags page is still 2.3.6.

    The version 2.4.0 package is already available on official Microsoft packages: https://packages.microsoft.com/debian/12/prod/pool/main/libm/libmsquic/

  4. wfurt commented on Aug 1, 2024

    @wfurt
    Member

    can you try ldd libmsquic.so @ShreyasZare. I'm wondering if there is dependency problem....

  5. wfurt commented on Aug 1, 2024

    @wfurt
    Member
  6. ShreyasZare commented on Aug 1, 2024

    @ShreyasZare
    Author

    can you try ldd libmsquic.so @ShreyasZare. I'm wondering if there is dependency problem....

    Tried this command on multiple systems (Debian, Ubuntu) and the output is always:

    ldd: ./libmsquic.so: No such file or directory
    
  7. ShreyasZare commented on Aug 1, 2024

    @ShreyasZare
    Author

    Tested this on latest Raspberry Pi OS which is based on Debian 12 on Raspberry Pi 4B (arm64) with libmsquic version 2.4.0 works without any issues.

    Also tested this on Ubuntu Server 24.04 LTS (x64) with libmsquic version 2.4.0 and it too has the same issue and QuicConnection.IsSupported returns false. Trying to make a QUIC connection throws following exception:

    System.PlatformNotSupportedException: System.Net.Quic is not supported on this platform: Unable to load MsQuic library version '2'.
       at System.Net.Quic.QuicConnection.ConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)
    

    I have also posted this in a comment on this msquic issue.

    Not sure if this is .NET specific issue or an issue with libmsquic itself.

  8. ladeak commented on Aug 1, 2024

    @ladeak
    Contributor

    I face the same issue with the prerelease .NET 9 version and ASP.NET Core on Linux Ubuntu 22.04:

    System.InvalidOperationException: Unable to bind an HTTP/3 endpoint. This could be because QUIC has not been configured using UseQuic, or the platform doesn't support QUIC or HTTP/3.

    Seems to work when I install v2.3.6 explicitly instead of 2.4.0

  9. ShreyasZare commented on Aug 2, 2024

    @ShreyasZare
    Author

    I face the same issue with the prerelease .NET 9 version and ASP.NET Core on Linux Ubuntu 22.04:

    Yes, Kestrel web server (ASP.NET Core) is also having same issue when attempting to enable HTTP/3 support.

  10. added this to the 9.0.0 milestone on Aug 2, 2024
  11. added
    tracking-external-issueThe issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 2, 2024
  12. ManickaP commented on Aug 2, 2024

    @ManickaP
    Member

    We're working with MsQuic team to fix this atm, the libmsquic 2.4 on packages.microsoft.com has an issue with dependencies. Workaround is to downgrade back to libmsquic 2.3.6. I'll let you know here when the package is fixed.

  13. liveans commented on Aug 5, 2024

    @liveans
    Contributor

    msquic 2.4.1 released (https://github.com/microsoft/msquic/releases/tag/v2.4.1) and packages are uploaded.
    Problem is not reproducing anymore with new package.

  14. ShreyasZare commented on Aug 6, 2024

    @ShreyasZare
    Author

    msquic 2.4.1 released (https://github.com/microsoft/msquic/releases/tag/v2.4.1) and packages are uploaded. Problem is not reproducing anymore with new package.

    I tested this on Ubuntu Server 24.04 and the issue still persists with libmsquic version 2.4.1.

    System.PlatformNotSupportedException: System.Net.Quic is not supported on this platform: Unable to load MsQuic library version '2'.
       at System.Net.Quic.QuicConnection.ConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)
    
  15. liveans commented on Aug 6, 2024

    @liveans
    Contributor

    msquic 2.4.1 released (https://github.com/microsoft/msquic/releases/tag/v2.4.1) and packages are uploaded. Problem is not reproducing anymore with new package.

    I tested this on Ubuntu Server 24.04 and the issue still persists with libmsquic version 2.4.1.

    System.PlatformNotSupportedException: System.Net.Quic is not supported on this platform: Unable to load MsQuic library version '2'.
       at System.Net.Quic.QuicConnection.ConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)
    

    Yes, looks like this is still reproducing for Ubuntu 24.04

  16. liveans commented on Aug 6, 2024

    @liveans
    Contributor

    @ShreyasZare looks like some dependencies are still missing for Ubuntu 24.04, and we will be working with msquic team to fix it.

    As a temporary workaround can you install libmsquic with these dependencies:

    • libxdp1
    • libnl-3-dev
    • libnl-route-3-dev

    Command:

    sudo apt install -y libmsquic libxdp1 libnl-3-dev libnl-route-3-dev
    

    Can you verify this fixes your issue as a workaround?

  17. ShreyasZare commented on Aug 6, 2024

    @ShreyasZare
    Author

    @liveans Thanks for the suggestion. I tried installing those dependencies on Ubuntu 24.04 (x64) and it worked. Thanks for that!

  18. liveans commented on Aug 11, 2024

    @liveans
    Contributor

    This issue should be fixed with msquic 2.4.3 release. If you can repro same issue again feel free to re-open/comment in this issue, so we can take a look.

  19. locked and limited conversation to collaborators on Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.Quictracking-external-issueThe issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions