rime / librime

Rime Input Method Engine, the core library
https://rime.im
BSD 3-Clause "New" or "Revised" License
3.31k stars 545 forks source link

how to disable 'Resource temporarily unavailable'? #904

Open Freed-Wu opened 2 months ago

Freed-Wu commented 2 months ago

Is your feature request related to a problem? Please describe.

I try to create many rime sessions with a same rime config. However, it will give me

E20240624 15:45:10.494415 137926437325056 level_db.cc:259] Error opening db 'luna_pinyin': IO error: lock .../rime/luna_pinyin.userdb/LOCK: Resource temporarily unavailable

It will not effect it work. I still want to know how to disable it.

Describe the solution you'd like Disable this error

Describe alternatives you've considered Decrease the error to warning or info.

fxliang commented 2 months ago

Maybe you should review your code on how you create sessions. I tested creating 101 sessions in a loop but got no errors.

ksqsf commented 2 months ago

LevelDB does not support concurrent Read and Write. If a session has opened it for writing, there's no way for other sessions to access it.

If you want to disable it, put enable_user_dict: false in your schema.

Freed-Wu commented 2 months ago

enable_user_dict: false

Disable it in *.custom.yaml? What is the side effect?

ksqsf commented 2 months ago

luna_pinyin.custom.yaml:

patch:
  translator/enable_user_dict: false

The side effect is that there won't be any user words, because you don't read it at all.

Freed-Wu commented 1 month ago

I set min_log_level to 3 to disable the error message. rime will printf any error message, it will disturb some programs' normal output.

  1. Except modify min_log_level, is there any method to silent error message?
  2. Or downgrade the message of levelDB from error to warning?
ksqsf commented 1 month ago

uh, I think I understand you now. You just want to suppress the error message.

it will disturb some programs' normal output

Are you using Rime in a TUI program? In that case, please refer to #799 . (i.e. building librime >= 1.10 in release mode should help.)

Freed-Wu commented 1 month ago

You just want to suppress the error message.

Yes, sorry for my bad expression :cry:

Are you using Rime in a TUI program

I try to use rime in zsh (this zsh plugin) and neovim (this vim plugin and that) I have to set min_log_level to 3 to disable the error message.

building librime >= 1.10 in release mode should help

I use rime 1.11.2. It still give me the error message if I don't set min_log_level = 3:

screen-2024-07-19-16-42-39