I think I found a bug in sqlite3_close but don't know how to fix it. There is a race condition between sqlite3SchemaFree and sqlite3Init. The problem is if there are two threads with its own connection to the same database file with shared-cache mode enabled. Db.pSchema of both connections point to the same schema. When the first thread is closing the connection and in the middle of sqlite3SchemaFree, where all the hash tables are freed but DB_SchemaLoaded in pSchema->flags is not cleared yet. If the other thread calls to sqlite3LocateTable at this time, it'll return no such table. Because sqlite3Init will see that DB_SchemaLoaded is still set and will not do anything.
The only mutex I see involved is db->mutex which not help in this case. Should there be a pSchema->mutex? Does anyone have this same problem? Jay PS. Sorry for the bad English. It's not my native language. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------