在OSX10.9上导致SQLite3崩溃的原因是什么?

时间:2014-02-04 13:15:13

标签: macos dll sqlite mono stack-trace

我正在尝试使用单独运行KMP multiplayer mod的C#服务器应用程序(开发版本可以找到here),它附带一个包含的sqlite3.dll库。

但是,在连接了多个客户端的情况下运行服务器几分钟后,服务器应用程序将崩溃并显示以下Stacktrace:

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods.sqlite3_prepare_v2 (intptr,intptr,int,intptr&,intptr&) <0xffffffff>
  at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection,string,System.Data.SQLite.SQLiteStatement,uint,string&) <0x003f3>
  at System.Data.SQLite.SQLiteCommand.BuildNextCommand () <0x001eb>
  at System.Data.SQLite.SQLiteCommand.GetStatement (int) <0x00023>
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteCommand.GetStatement (int) <0xffffffff>
  at System.Data.SQLite.SQLiteDataReader.NextResult () <0x0031f>
  at System.Data.SQLite.SQLiteDataReader..ctor (System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior) <0x00177>
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteDataReader..ctor (System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior) <0xffffffff>
  at System.Data.SQLite.SQLiteCommand.ExecuteReader (System.Data.CommandBehavior) <0x00047>
  at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery () <0x00027>
  at KMPServer.Server.HandleUDPProbe (KMPServer.Client,byte[]) <0x00318>
  at KMPServer.Server.handleMessage (KMPServer.Client,KMPCommon/ClientMessageID,byte[]) <0x0022f>
  at KMPServer.Server.asyncUDPReceive (System.IAsyncResult) <0x0035f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

这里包括原生gbd stacktrace:https://gist.github.com/CarnotInteractive/cba680da54e05ad7f940


似乎在UDP代码的某处,SQLite库崩溃了,这在Windows上运行相同的代码时不会发生。

mod的开发人员建议尝试找到不同的sqlite3绑定或库,但即使在下载sqlite source code之后,在我的Mac上编译它然后使用生成的“libsqlite3.0.dylib”库我仍然得到这个错误。

这可能直接与Mono有关吗?可能导致此问题的原因,以及如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

使用以下调试变量运行mono:

export MONO_LOG_LEVEL=debug;
export MONO_LOG_MASK=dll; 

我能够弄清楚虽然mono能够看到我编译的dylib,但它没有加载它,说它是错误的架构。

服务器可执行文件是32位,当从源代码编译sqlite只有./configure时,生成的库只有64位。

然后我尝试将其编译为32位:

CFLAGS='-arch i686' LDFLAGS='-arch i686' ./configure --disable-dependency-tracking;
make;

生成的dylib已正确加载,似乎已解决问题。我不再像以前那样得到同样的崩溃。


总之,似乎无论出于何种原因,位于/usr/lib/libsqlite3.dylib的默认mac sqlib都会导致单声道崩溃和我尝试运行的可执行文件。编译我自己的32位版本解决了这个问题。