Help! Crash after windows update (SQLiteDatabase.dll BUG)

My app was working fine since the last update in September. Recently a windows update (1709) causes my app to crash ‘all the time’. It’s a hard crash, no exception to be handled. I commented out all my declares to make sure I have only Xojo code. Currently running the app in compatibility mode for windows makes the app usable although it still crashes occasionally. I tried compiling the app with 2015r3.1 and it doesn’t crash. However going back to 2015r3.1 will require a lot of other work so I hope I don’t need to do that. Any suggestions where to look?

Understandably my customers are very concerned and upset. They don’t like to type in an entire order and have a crash before they save it.

Here is the mini dump. It looks like a Xojo bug?

https://www.dropbox.com/s/ryviejm1k32w3ma/DebugQB%20Metal%20Shop.dmp?raw=1

Try it with 2017r3 and see if it crashes?

Yes it crashes with 2017r1.1, and 2017r3. I was able to make changes and get my project to work compiling with 2015r1 so at least the pressure is off.

Can I ask why 2015r1 and not something newer from 2016?

Can you create a FB case with a sample code that reproduce this? I hope the team can help you.

Try to run dbgview (a free utility from the Microsoft Sysinternals suite). Run dbgview first, then launch your application and make it crash. Right away, dbgview should have information on what failed. It could be that a library was either removed or moved to a location that your application does not expect, or perhaps something completely different.

edit: fixed a typo

And of course now we’re curious what you changed to get it working again.

That’s what I was using before going to 2017r2 and I was focused on getting a temporary hot fix.

Unfortunately this is a very complex project and was not able to reproduce it in a simple example.

Mostly flicker related stuff. I had used Julian’s zorder fix code and 2015r3 went bonkers over that.

I’ll try that in a minute.

I don’t think this is the case but I could be wrong.

Thanks to everyone for your input.

All I get is a list of handles to all the controls in my app.

OK Now I’m seeing

That doesn’t really mean anything to me though.

Ok using Windbg it looks like it’s a problem with the sqlite plugin.

Boo that’s no good.
Now you need to find out how you’re killing it!

Here are the only places I write to a SQLite file. Can’t see how it could possibly be ‘my fault’.

Function Setting(Name as string) As DatabaseField
  pSQLps = MainDB.Prepare("Select * From Settings where Name like $1")
  dim rs as RecordSet = pSQLps.SQLSelect(Name)
  if MainDB.Error then MsgBoxT MainDB.ErrorMessage
  if rs <>nil and rs.RecordCount > 0 then
    return rs.Field("Value")
  else
    pSQLps = MainDB.Prepare("INSERT INTO Settings (Name, Value) VALUES ($1,$2)")
    pSQLps.SQLExecute(Name,"")
    pSQLps = MainDB.Prepare("Select * From Settings where Name like $1")
    rs = SQLps.SQLSelect(Name)
    if MainDB.Error then MsgBoxT MainDB.ErrorMessage
    if rs <> nil and rs.RecordCount > 0 then
      return rs.Field("Value")
    else
      MsgBoxT "I don't know what is wrong! Problem in Settings module."
    end if
  end if
End Function

[code]Sub Setting(Name as string, Assigns Value as Variant)
pSQLps = MainDB.Prepare(“Select * From Settings where Name like $1”)
dim rs as RecordSet = pSQLps.SQLSelect(Name)
if MainDB.Error then MsgBoxT MainDB.ErrorMessage
if rs = nil or rs.RecordCount = 0 then
'if setting is not in table add it
pSQLps = MainDB.Prepare(“INSERT INTO Settings (Name, Value) VALUES ($1,$2)”)
pSQLps.SQLExecute(Name,Value)
if MainDB.Error then MsgBoxT MainDB.ErrorMessage

Else
'otherwise update it
pSQLps = MainDB.Prepare(“UPDATE Settings SET Value = $1 where Name = $2”)
pSQLps.SQLExecute(Value.StringValue,Name)
if MainDB.Error then MsgBoxT MainDB.ErrorMessage
end if
End Sub
[/code]

The stack trace is showing a conversion from int to float just below your crash (I assume thats what IntToFP does).

I note that in your INSERT you’re doing:

pSQLps.SQLExecute(Name,Value)

however, in your UPDATE you’re doing

pSQLps.SQLExecute(Value.StringValue,Name)

Try changing the INSERT to:

pSQLps.SQLExecute(Name,Value.StringValue)

I think that you need to define bind types for use with your prepared statements. That may not be the problem but it can’t hurt.

OK tried this with same results.

[code]Public Sub Setting(Name as string, Assigns Value as Variant)
SQLps = SettingsDB.Prepare(“Select * From Settings where Name like ?”)
SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
dim rs as RecordSet = SQLps.SQLSelect(Name)
SettingsDB.ShutDownIfIOError
if SettingsDB.Error then MsgBoxT SettingsDB.ErrorMessage
if rs = nil or rs.RecordCount = 0 then
'if setting is not in table add it
SQLps = SettingsDB.Prepare(“INSERT INTO Settings (Name, Value) VALUES (?,?)”)
SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
SQLps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
SQLps.SQLExecute(Name,Value.StringValue)
if SettingsDB.Error then MsgBoxT SettingsDB.ErrorMessage

Else
'otherwise update it
SQLps = SettingsDB.Prepare(“UPDATE Settings SET Value = ? where Name = ?”)
SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
SQLps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
SQLps.SQLExecute(Value.StringValue,Name)
if SettingsDB.Error then MsgBoxT SettingsDB.ErrorMessage
end if
End Sub
[/code]

Public Function Setting(Name as string) as DatabaseField
  SQLps = SettingsDB.Prepare("Select * From Settings where Name like ?")
  SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
  dim rs as RecordSet = SQLps.SQLSelect(Name)
  SettingsDB.ShutDownIfIOError
  if SettingsDB.Error then MsgBoxT SettingsDB.ErrorMessage
  if rs <>nil and rs.RecordCount > 0 then
    return rs.Field("Value")
  else
    SQLps = SettingsDB.Prepare("INSERT INTO Settings (Name, Value) VALUES (?,?)")
    SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
    SQLps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
    SQLps.SQLExecute(Name,"")
    SQLps = SettingsDB.Prepare("Select * From Settings where Name like ?")
    SQLps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
    rs = SQLps.SQLSelect(Name)
    if SettingsDB.Error then MsgBoxT SettingsDB.ErrorMessage
    if rs <> nil and rs.RecordCount > 0 then
      return rs.Field("Value")
    else
      MsgBoxT "I don't know what is wrong! Problem in Settings module."
    end if
  end if
End Function

Have you tried this in the debugger? Something other than the code may be the problem.

Same problem in the debugger. Unfortunately there are so many things going on (timers, painting, etc.) that it is hard to find the line it crashes on.

I did find that the problem is definitely in the SQLiteDatabase.dll.

<https://xojo.com/issue/51521>

Where does the sqlite file reside? Did the windows update change the permissions/access to that folder?

It’s in the App Libs folder. No it’s not a permissions/access problem.

Opps read your question wrong, and thought you meant the sqlitedatabse.dll. The sqlite database is in a subfolder in the same folder as the app. And I can read and write just fine. It’s the crashes that are the problem.