0

I am using Litedb v4 in Xamarin, I am creating liteDatabase connection and getting collections inside it once, and passing the collection to multiple threads which perform givenCollection.findALL().ToList() simultaneously. The app crashes sometimes(not always) resulting in SIGSEGV error, I am not getting what is causing this error.

Code to Reproduce

protected async virtual Task<IEnumerable<T>> ReadAllItems<T>(LiteCollection<T> collection)
{
    return await Task.Run(() =>
    {
          return collection.FindAll().ToList();
     });
}

I am getting the collection object once and passing to the above method. calling above method multiple times one after another causing the error.

This is the log I am getting:

  at <unknown> <0xffffffff>
  at System.String:FastAllocateString <0x00037>
  at System.String:CreateStringFromEncoding <0x000fb>
  at System.Text.UTF8Encoding:GetString <0x002a3>
  at LiteDB.BsonReader:ReadString <0x00143>
  at LiteDB.BsonReader:ReadElement <0x00227>
  at LiteDB.BsonReader:ReadDocument <0x0015b>
  at LiteDB.BsonReader:ReadElement <0x002af>
  at LiteDB.BsonReader:ReadDocument <0x0015b>
  at LiteDB.BsonReader:ReadElement <0x002af>
  at LiteDB.BsonReader:ReadArray <0x0015b>
  at LiteDB.BsonReader:ReadElement <0x0031f>
  at LiteDB.BsonReader:ReadDocument <0x0015b>
  at LiteDB.BsonReader:ReadElement <0x002af>
  at LiteDB.BsonReader:ReadDocument <0x0015b>
  at LiteDB.BsonReader:Deserialize <0x0009b>
  at LiteDB.QueryCursor:Fetch <0x003eb>
  at <Find>d__9:MoveNext <0x007a3>
  at <Find>d__13:MoveNext <0x00e63>
  at <Find>d__17:MoveNext <0x00593>
  at System.Collections.Generic.List`1:AddEnumerable <0x00287>
  at System.Collections.Generic.List`1:.ctor <0x0038f>
  at <>c__DisplayClass7_0`1:<ReadAllItems>b__0 <0x0013b>
  at System.Threading.Tasks.Task`1:InnerInvoke <0x000d7>
  at System.Threading.Tasks04-11 02:13:11.211 F/libc    
 (13977): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1b in tid 14021 (Thread Pool Wor)
sanjiv saini
  • 356
  • 1
  • 3
  • 11

0 Answers0