suurjaak / InputScope

Mouse and keyboard input heatmap visualizer, with statistics.
MIT License
87 stars 13 forks source link

Database is locked #1

Closed andrewbaxter closed 3 years ago

andrewbaxter commented 8 years ago

In a new installation, I get this when I try to load the webpage.

Traceback (most recent call last):
  File ".../.local/python2/lib/python2.7/site-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File ".../.local/python2/lib/python2.7/site-packages/bottle.py", line 1732, in wrapper
    rv = callback(*a, **ka)
  File ".../.local/python2/lib/python2.7/site-packages/inputscope/webui.py", line 85, in index
    row = db.fetchone("counts", countminmax, type=table)
  File ".../.local/python2/lib/python2.7/site-packages/inputscope/db.py", line 31, in fetchone
    return select(table, cols, where, group, order, limit, **kwargs).fetchone()
  File ".../.local/python2/lib/python2.7/site-packages/inputscope/db.py", line 45, in select
    return execute(sql, args)
  File ".../.local/python2/lib/python2.7/site-packages/inputscope/db.py", line 64, in execute
    return get_cursor().execute(sql, args or {})
OperationalError: database is locked

The webpage gives me a 500 error.

fuser and ps:

[... var]$ fuser inputscope.db
.../.local/python2/lib/python2.7/site-packages/inputscope/var/inputscope.db:  3150  3151  3152
[... var]$ fuser inputscope.db-journal 
.../.local/python2/lib/python2.7/site-packages/inputscope/var/inputscope.db-journal:  3151
[... var]$ ps aux | grep 315
...    3150  0.0  0.3 152648 27956 pts/63   S+   02:07   0:00 .../.local/python2/bin/python2 .../.local/python2/bin/inputscope
...    3151  0.9  0.2 371772 17268 pts/63   Sl+  02:07   0:01 .../.local/python2/bin/python2 .../.local/python2/lib/python2.7/site-packages/inputscope/listener.py --quiet
...    3152  0.0  0.2  95212 17120 pts/63   S+   02:07   0:00 .../.local/python2/bin/python2 .../.local/python2/lib/python2.7/site-packages/inputscope/webui.py --quiet

I've remapped my function keys to some strange unicode characters, and get these error when I press them:

...
Unable to determine character.
Keycode: 69 KeySym 16846434
Unable to determine character.
Keycode: 69 KeySym 16846434
Unable to determine character.
Keycode: 70 KeySym 16846435
Unable to determine character.
Keycode: 70 KeySym 16846435
...

If that's the problem I'd just assume ignore those keys.

I'm running it in a virtual environment.

Also, killing with ctrl+c leaves a python2 process running in the background.

This looks like a great program, really excited to use it.

suurjaak commented 8 years ago

Damn, the database access error is something I've not encountered yet. I suppose all database writes can be moved to one component.. Does the error happen on every launch? What happens if you run the listener and webui separately (commands inputscope-listener and inputscope-webui)?

The Unicode key errors are coming from the pyuserinput library that InputScope uses to detect user activity. These messages are not significant, the library just prints them out for some reason.

Regarding Ctrl-C and orphan processes, I have a fix in mind, will test it.

andrewbaxter commented 8 years ago

The error happens on every launch. Running the listener and webui at separate times works fine, using that workaround for the moment.

Also: Arch linux, ext4.

suurjaak commented 3 years ago

Oops, sorry for having dropped off without any further interaction for so long.

Looks like I will be doing some additional work on this project again, so database locking will no longer be an issue in the next release.

suurjaak commented 3 years ago

Database lock errors should no longer occur in the new v1.3 release.