使用.NETCore 3.1的Fedora 32上的2.11和2.10.4驱动程序崩溃

问题描述

我有一堆访问MongoDB的服务。我将这些服务从.NETCore 2.1升级到了 3.1 。现在,在我的一台服务器上,MongoDB驱动程序崩溃有很多问题。首先,我使用驱动程序版本2.11.0,创建了MongoClient的实例后,最终导致了以下崩溃:

System.IO.IOException: Invalid argument
  at System.IO.FileStream.CheckFileCall(Int64 result,Boolean ignoreNotSupported) in /_/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs:828
  at System.IO.FileStream.ReadNative(Span`1 buffer) in /_/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs:495
  at System.IO.FileStream.ReadSpan(Span`1 destination) in /_/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs:418
  at System.IO.FileStream.Read(Byte[] array,Int32 offset,Int32 count) in /_/src/System.Private.CoreLib/shared/System/IO/FileStream.cs:304
  at System.IO.StreamReader.ReadBuffer() in /_/src/System.Private.CoreLib/shared/System/IO/StreamReader.cs:594
  at System.IO.StreamReader.ReadToEnd() in /_/src/System.Private.CoreLib/shared/System/IO/StreamReader.cs:415
  at System.IO.File.InternalReadAllText(String path,Encoding encoding) in /_/src/System.IO.FileSystem/src/System/IO/File.cs:296
  at System.IO.File.ReadAllText(String path) in /_/src/System.IO.FileSystem/src/System/IO/File.cs:274
  at System.Net.networkinformation.StringParsingHelpers.ParseRawLongFile(String filePath) in /_/src/System.Net.networkinformation/src/System/Net/networkinformation/StringParsingHelpers.Misc.cs:64
  at System.Net.networkinformation.LinuxNetworkInterface.GetSpeed(String name) in /_/src/System.Net.networkinformation/src/System/Net/networkinformation/LinuxNetworkInterface.cs:202

我尝试更深入地调试它,并找到文件LinuxNetworkInterface.cs并找到方法

private static long? GetSpeed(string name)
{
    try
    {
        string path = Path.Combine(NetworkFiles.SysClassNetFolder,name,NetworkFiles.SpeedFileName);
        long megabitsPerSecond = StringParsingHelpers.ParseRawLongFile(path);
        return megabitsPerSecond == -1
            ? megabitsPerSecond
            : megabitsPerSecond * 1_000_000; // Value must be returned in bits per second,not megabits.
    }
    catch (Exception) // Ignore any problems accessing or parsing the file.
    {
        return null;
    }
}

在执行名称解析时会调用方法名称解析似乎起源于MongoDB驱动程序中名为MongoUrlBuilder.Parse()的方法

因此,我将所有服务器和库中的驱动程序降级为2.10.4版。使用此版本,我可以成功创建MongoClient的实例,但是现在,一旦驱动程序首次尝试访问数据库,它就会崩溃并出现其他异常:

System.PlatformNotSupportedException: Socket.IOControl handles Windows-specific control codes and is not supported on this platform.
  at System.Net.sockets.socketPal.WindowsIoctl(SafeSocketHandle handle,Int32 ioControlCode,Byte[] optionInValue,Byte[] optionOutValue,Int32& optionLength) in /_/src/System.Net.sockets/src/System/Net/Sockets/SocketPal.Unix.cs:1075
  at System.Net.sockets.socket.IOControl(Int32 ioControlCode,Byte[] optionOutValue) in /_/src/System.Net.sockets/src/System/Net/Sockets/Socket.cs:1753
  at System.Net.sockets.socket.IOControl(IOControlCode ioControlCode,Byte[] optionOutValue) in /_/src/System.Net.sockets/src/System/Net/Sockets/Socket.cs:1768
  at at MongoDB.Driver.Core.Connections.TcpstreamFactory.CreateSocket(EndPoint endPoint)

再次运行时环境:

发展:

  • Fedora 32工作站
  • .NETCore 3.1 SDK
  • JetBrains骑士2020.1

服务器:

  • CentOS 7
  • MongoDB 4.0.19

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...