SQLite database locked - access violations

167 views
Skip to first unread message

wwwald

unread,
Aug 3, 2016, 3:25:34 AM8/3/16
to wikidpad-devel
Hi, 
I'm currently running into problems with opening my wiki's on two different laptops.
My setup:
  • wiki files are synced via Dropbox
  • sometimes I edit on personal laptop, sometimes on work laptop
  • WikidPad runs on Python 2.7.12 + wxPython 3.0.2.0 installed in a dedicated virtualenv
Now, the Dropbox syncing must have messed up somewhere. On laptop 1, everything opens as expected, on laptop 2, I get these error messages when opening the wiki:
  • Wiki ... is probably in use by different instance of Wikidpad. Connect anyway (dangerous)?
    --> I can't find any Python processes that are accessing the wiki, no clue where this comes from
  • After clicking "Yes": Can't write to database '...'. database is locked [5].
  • And then immediately: Connection lost - Database connection error: exception: access violation reading 0xFFFFFFFFFFFFFFFF. Try to re-establish, then run "Wiki"->"Reconnect"
This seems to be SQLite that suspects the database is in use by another process - but again, no processes to be found.
The virtualenv's on both laptops are exactly the same, same Python version, same wxPython version.

The error log shows entries like this:
Version: 'wikidPad 2.3beta15' Session start: 2016-08-03 09:07:36
Traceback (most recent call last):
  File "lib\pwiki\wikidata\WikiDataManager.py", line 453, in connect
    self.wikiData.connect()
  File "lib\pwiki\wikidata\WikiDataManager.py", line 257, in __call__
    return self.callFunction(*args, **kwargs)
  File "lib\pwiki\wikidata\original_sqlite\WikiData.py", line 207, in connect
    raise lastException
DbWriteAccessError: database is locked [5]
Traceback (most recent call last):
  File "lib\pwiki\wikidata\original_sqlite\WikiData.py", line 1116, in isDefinedWikiPageName
    "select 1 from wikiwords where word = ?", (word,)))
  File "lib\pwiki\wikidata\original_sqlite\DbStructure.py", line 97, in execSqlQuerySingleItem
    self.dbCursor.execute(sql, params)
  File "lib\pwiki\sqlite3api.py", line 331, in execute
    self.stmt = self.conn.prepare(sql)
  File "lib\pwiki\sqlite3api.py", line 98, in prepare
    return [self.thinConn.prepare(sql), None]
  File "lib\pwiki\SqliteThin3.py", line 613, in prepare
    len(sql), byref(stmtref), 0))
WindowsError: exception: access violation reading 0xFFFFFFFFFFFFFFFF


Version: 'wikidPad 2.3beta15' Session start: 2016-08-03 09:15:24
Traceback (most recent call last):
  File "lib\pwiki\wikidata\original_sqlite\WikiData.py", line 1116, in isDefinedWikiPageName
    "select 1 from wikiwords where word = ?", (word,)))
  File "lib\pwiki\wikidata\original_sqlite\DbStructure.py", line 97, in execSqlQuerySingleItem
    self.dbCursor.execute(sql, params)
  File "lib\pwiki\sqlite3api.py", line 331, in execute
    self.stmt = self.conn.prepare(sql)
  File "lib\pwiki\sqlite3api.py", line 98, in prepare
    return [self.thinConn.prepare(sql), None]
  File "lib\pwiki\SqliteThin3.py", line 613, in prepare
    len(sql), byref(stmtref), 0))
WindowsError: exception: access violation reading 0xFFFFFFFFFFFFFFFF

Any clues on getting this fixed?

Thanks a bunch for any input,
wwwald

Michael Butscher

unread,
Aug 4, 2016, 7:57:58 PM8/4/16
to wikidpa...@googlegroups.com
On 03.08.2016 09:25, wwwald wrote:
> Hi,
> I'm currently running into problems with opening my wiki's on two different
> laptops.
> My setup:
>
> - wiki files are synced via Dropbox
> - sometimes I edit on personal laptop, sometimes on work laptop
> - WikidPad runs on Python 2.7.12 + wxPython 3.0.2.0 installed in a
> dedicated virtualenv
>
> Now, the Dropbox syncing must have messed up somewhere. On laptop 1,
> everything opens as expected, on laptop 2, I get these error messages when
> opening the wiki:
>
> - Wiki ... is probably in use by different instance of Wikidpad. Connect
> anyway (dangerous)?
> --> I can't find any Python processes that are accessing the wiki, no
> clue where this comes from

This message simply appears if a lock file is present. This lock file is placed
in the wiki folder (above the "data" folder) and if your wiki is named e.g.
"MyWiki" then the lock file name is "MyWiki.wiki.lock". It is just a simple
safety measure against multiple processes mesing up a wiki.


> - After clicking "Yes": Can't write to database '...'. database is
> locked [5].
> - And then immediately: Connection lost - Database connection error:
> exception: access violation reading 0xFFFFFFFFFFFFFFFF. Try to
> re-establish, then run "Wiki"->"Reconnect"
>
> This seems to be SQLite that suspects the database is in use by another
> process - but again, no processes to be found.

You could try a tool like "Process Hacker" (despite the name it has nothing to
with real hacking):

http://processhacker.sourceforge.net/


In menu "Hacker" it has the function "Find handles or DLLs" (shortcut: Ctrl-F).
You can enter there e.g. ".sli" to find all files containing this (like the
"wiki.sli" or "wikiovw.sli" file of the WikidPad Sqlite database) which are
currently opened by a process. The list also contains the process name and id.



Michael

wwwald

unread,
Aug 22, 2016, 2:43:36 AM8/22/16
to wikidpad-devel
Apologies for the delay (holidays).

OK for the .lock file - it's only a side effect of the "access violation" problem.

I'm still seeing the "access violation" error, though. I've used Process Hacker to close any remaining .sli file handles, but I still get the same error message.
I already tried swapping out the SQLite3 DLL (currently on latest version 3.14.1), running everything on 64bit Python 2.17.12.

The strange thing is that the same setup does work on my home laptop. I've been looking for differences but haven't found any yet... program & data files are identical (Dropbox synced), and the Python installed libs too according to "pip freeze".

The .sli file seems to be a perfectly valid database, I can open it using tools like SQLiteStudio and browse the contents without problems.

Do you have any other ideas on what might be going wrong? Can I do something to narrow down the problem?

Thanks a bunch for your time,
wwwald

wwwald

unread,
Aug 22, 2016, 9:25:19 AM8/22/16
to wikidpad-devel
OK, some progress in getting WikidPad to run.

In an attempt to trace down the problem, I inserted a print() statement in pwiki/sqlite3api.py to display the queries that are executed on the SQLite backend.
With the print() statement included, WikidPad starts just fine and opens my wiki. When I remove the print statement, it stops again on startup with the "access violation" error.

I know it sounds completely absurd that a print() statement would make a difference, but then I found [this link](https://sourceforge.net/p/ctypes/mailman/message/20524909/) mentioning something similar. 

So, it seems that this may have to do with ctypes and argument passing to the SQLite3 DLL.

I'll report back if I find out more.
Reply all
Reply to author
Forward
0 new messages