lundi 14 septembre 2015

Why is this causing a stack overlflow ? Recursive function and SQLITE

I have a function that constantly needs to check if there is work to do and it goes about in the following fasion:

PSEUDOCODE

    Class SeperateThread
    {

      function Start()
      {
         DoWork();
      }

      function DoWork()
      {
         New DBContext;
         DBContext.GetWorkFromTables();
         Perform work in Extra Seperate Threads if there is work to do...

        NotifyWhenTasksAreFinished();
      }

      NotifyWhenTasksAreFinished()
      {
         (Loop)Check if tasks are finished in seperate thread

         If Tasks are finished
           Break loop, wait a few seconds and....
             DoWork();
      }
}

I'm using SQLITE and getting a stack overflow in SQLITE.interop.dll

The only place where SQLITE work is done is with "DBContext.GetWorkFromTables()".

All this works fine for a few hours... after a few hours... APPCRASH with stack overflow inside sqlite.interop.dll

Can anyone explain what's the reason for this and perhaps a workaround? I suspect the recursive function has something to do with it...

Could it be that the DBContext is not being disposed automatically and maybe this is the cause?

I'm using telerik Data Access as ORM but it kinda works like Entity Framework.

Aucun commentaire:

Enregistrer un commentaire