fcitx / fcitx5-rime

223 stars 22 forks source link

`Error opening db '...': IO error: lock .../...userdb/LOCK: already held by process` #97

Closed sci-42ver closed 6 months ago

sci-42ver commented 6 months ago

In weasel 0.15.0, currently it doesn't have the above error when sync although it used to. I checked by Resource Monitor that the LOCK is held by WeaselServer.exe.

In archlinux, melt_eng is the primary translator of the current used schema which also uses the easy_en dict. I use the same yaml cfgs in Fcitx5 as weasel.

$ lsof /home/czg_arch/.local/share/fcitx5/rime/rime_ice.userdb/LOCK # this related dict can be synced
$ lsof /home/czg_arch/.local/share/fcitx5/rime/melt_eng.userdb/LOCK # this will fail
COMMAND PID     USER FD   TYPE DEVICE SIZE/OFF     NODE NAME
fcitx5  825 czg_arch 21u   REG   0,26        0 13117969 /home/czg_arch/.local/share/fcitx5/rime/melt_eng.userdb/LOCK
$ lsof /home/czg_arch/.local/share/fcitx5/rime/easy_en.userdb/LOCK # this related dict can also be synced
COMMAND PID     USER FD   TYPE DEVICE SIZE/OFF    NODE NAME
fcitx5  825 czg_arch 32u   REG   0,26        0 1689291 /home/czg_arch/.local/share/fcitx5/rime/easy_en.userdb/LOCK
$ ps aux | grep 825
czg_arch     825  0.3  0.9 682696 141752 ?       Sl   00:05   0:09 /usr/bin/fcitx5 --verbose=default=4,rime=5 -d > /home/czg_arch/fcitx5.log 2>&1
$ pgrep -P 825 # show nothing
$ journalctl -b -f | grep kwin_wayland_wrapper | grep -v -E 'D[0-9]' | grep -i lock -A 4 -B 4 # after sync
pr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: I20240416 00:51:32.410361 135316287522496 user_dict_manager.cc:196] merging snapshot file: "/home/czg_arch/.local/share/fcitx5/rime/sync/fcitx5/melt_eng.userdb.txt"
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: I20240416 00:51:32.428962 135316287522496 db.cc:55] creating metadata for db '.temp'.
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: I20240416 00:51:32.429039 135316287522496 user_db.cc:129] restoring userdb '.temp' from "/home/czg_arch/.local/share/fcitx5/rime/sync/fcitx5/melt_eng.userdb.txt"
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: I20240416 00:51:32.429053 135316287522496 tsv.cc:18] reading tsv file: "/home/czg_arch/.local/share/fcitx5/rime/sync/fcitx5/melt_eng.userdb.txt"
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: E20240416 00:51:32.429359 135316287522496 level_db.cc:259] Error opening db 'melt_eng': IO error: lock /home/czg_arch/.local/share/fcitx5/rime/melt_eng.userdb/LOCK: already held by process
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: I20240416 00:51:32.429391 135316287522496 level_db.cc:284] closed db '.temp'.
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: E20240416 00:51:32.429796 135316287522496 user_dict_manager.cc:198] failed to merge snapshot file: "/home/czg_arch/.local/share/fcitx5/rime/sync/fcitx5/melt_eng.userdb.txt"
Apr 16 00:51:32 CzgArch kwin_wayland_wrapper[825]: E20240416 00:51:32.430020 135316287522496 level_db.cc:273] Error opening db 'melt_eng' read-only.
sci-42ver commented 6 months ago

This is one weird problem. Temporarily for one workaround in Fcitx5 (maybe not for others like hamster where it doesn't say 'LOCK: already held by process' but still says "Error opening db '...' read-only."), I switch to one fake schema which doesn't use any translator, therefore no LOCKs are held. Then re-deploy. Now sync doesn't throw one error.


It is due to the Memory(...) in lua which preempts the LOCK which occurs also in hamster. Probably weasel solves with this inherently.