randomouscrap98 / contentapi

A generic content system to make some kinda standard websites
GNU General Public License v3.0
9 stars 2 forks source link

500 error from /Write/message (Add retry to database work sections) #122

Open 12Me21 opened 2 years ago

12Me21 commented 2 years ago

This only happened once, and the request succeeded when I tried again

Unhandled exception: System.ObjectDisposedException: Safe handle has been closed.
Object name: 'SafeHandle'.
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_prepare_v2(sqlite3 db, Byte* pSql, Int32 nBytes, IntPtr& stmt, Byte*& ptrRemain)
   at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_prepare_v2(sqlite3 db, ReadOnlySpan`1 sql, IntPtr& stm, ReadOnlySpan`1& tail)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
   at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
   at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel, Boolean deferred)
   at contentapi.Main.DbWriter.DatabaseWork_Message(DbWorkUnit`1 work) in /home/csanchez/projects/contentapi/contentapi/Main/DbWriter.cs:line 818
   at contentapi.Main.DbWriter.GenericWorkAsync[T](T view, UserView requester, UserAction action, String message) in /home/csanchez/projects/contentapi/contentapi/Main/DbWriter.cs:line 506
   at contentapi.Main.DbWriter.WriteAsync[T](T view, Int64 requestUserId, String message) in /home/csanchez/projects/contentapi/contentapi/Main/DbWriter.cs:line 103
   at contentapi.Controllers.WriteController.<>c__DisplayClass3_0.<<WriteMessageAsync>b__0>d.MoveNext() in /home/csanchez/projects/contentapi/contentapi/Controllers/WriteController.cs:line 36
--- End of stack trace from previous location ---
   at contentapi.Controllers.BaseController.MatchExceptions[T](Func`1 perform) in /home/csanchez/projects/contentapi/contentapi/Controllers/BaseController.cs:line 113
randomouscrap98 commented 2 years ago

Hmm happened on begin transaction. How is it that YOU are the one who has so many problems with messages, I've never seen this before and I don't think a single other person has had this problem. I don't think I can fix this other than to have some kind of retry system in place... I suppose that's what I'll do. I can't do much when I ask for a transaction from sqlite and it explodes...

edit: I'm sorry, I came back and read this and realized it was rather accusatory and aggressive, and I was just meaning to make a joke, sorry about that.

randomouscrap98 commented 2 years ago

This will be a low priority though, fyi. It's such a ridiculously rare occurrence and happens outside of my domain anyway