You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Q: After using it for a while, we get "too many open files" errors.
During db.vlog.open error: Unable to open log dir.. Path=/var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans. Error=fcntl /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans: too many open files
A: Due to the limitation of max file descriptors of the operating system, cache files more than the default size will cause this error.
Are there any Linux specific settings that I should use?
We recommend setting max file descriptors to a high number depending upon the expected size of your data. On Linux and Mac, you can check the file descriptor limit with ulimit -n -H for the hard limit and ulimit -n -S for the soft limit. A soft limit of 65535 is a good lower bound. You can adjust the limit as needed.
We have a plan to switch the cache DB from badger to SQLite3. Though, as of 2023/03/07, the current workaround is to change the max file descriptors of the OS settings.
On macOS, you need to change the /Library/LaunchDaemons/limit.maxfiles.plist as below.
QiiTrans をしばらく使い続けると以下の too many open files エラーがでて使えなくなります。
キャッシュ・ディレクトリを削除すると使えるようになる。
キャッシュ・ディレクトリは 2.0 MB 程度。
macOS や Linux で発生する。
ログ
$ qiitrans ja en es en ja --verbose- ストップワード: q>>> おはようございます。Opening file: "/var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000389.sst" error: open /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000389.sst: too many open filesunable to open: /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000389.sstgithub.com/dgraph-io/ristretto/z.OpenMmapFile /home/runner/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.4-0.20210309073149-3836124cdc5a/z/file.go:80github.com/dgraph-io/badger/v3.newLevelsController.func1 /home/runner/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.0/levels.go:145runtime.goexit /opt/hostedtoolcache/go/1.17.6/x64/src/runtime/asm_amd64.s:1581
$ # キャッシュを使わない
$ qiitrans ja en es en ja --verbose --no-cache- ストップワード: q>>> おはようございます。Opening file: "/var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000203.sst" error: open /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000203.sst: too many open filesunable to open: /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans/000203.sstgithub.com/dgraph-io/ristretto/z.OpenMmapFile /home/runner/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.4-0.20210309073149-3836124cdc5a/z/file.go:80github.com/dgraph-io/badger/v3.newLevelsController.func1 /home/runner/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.0/levels.go:145runtime.goexit /opt/hostedtoolcache/go/1.17.6/x64/src/runtime/asm_amd64.s:1581
$ # 容量確認
$ du -d1 -h /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans2.0M /var/folders/8c/lmckjks95fj4h_jqzw4v3k_w0000gn/T/QiiTrans
$ # キャッシュを完全削除してから使う
$ qiitrans ja en es en ja --verbose --clear- ストップワード: q>>> おはようございます。JA -> EN: Good morning.EN -> ES: Buenos días.ES -> EN: Good morning.再翻訳: おはようございます。
キャッシュ DB として利用している badger の下記によると、恐らく OS 側の仕様が関係していると思われます。
Are there any Linux specific settings that I should use?
We recommend setting max file descriptors to a high number depending upon the expected size of your data. On Linux and Mac, you can check the file descriptor limit with ulimit -n -H for the hard limit and ulimit -n -S for the soft limit. A soft limit of 65535 is a good lower bound. You can adjust the limit as needed.
Q: After using it for a while, we get "too many open files" errors.
A: Due to the limitation of max file descriptors of the operating system, cache files more than the default size will cause this error.
We have a plan to switch the cache DB from
badger
to SQLite3. Though, as of 2023/03/07, the current workaround is to change themax file descriptors
of the OS settings.On macOS, you need to change the
/Library/LaunchDaemons/limit.maxfiles.plist
as below.しばらく使い続けると "too many open files" エラーが発生する
現象
QiiTrans をしばらく使い続けると以下の
too many open files
エラーがでて使えなくなります。ログ
原因
ログの流れを見ると、キャッシュを使う・使わない関係なく、DB を読み込む時点でエラーが発生していると思われます。
キャッシュ DB として利用している
badger
の下記によると、恐らく OS 側の仕様が関係していると思われます。つまり、OS 側のファイルディスクリプタの制限で、ソフトウェア側が同時に参照できるファイル数を超過したのだと思われます。
確かに、
ulimit
で制限を確認するとハードとしては無制限に設定されているものの、ソフトは 256 個しか許可されていません。回避方法
badger
公式が "We recommend settingmax file descriptors
to a high number" と言っているように、Soft-ulimit の上限を引き上げる必要があります。.plist
ファイルをroot:wheel
で作成し制限を引き上げる必要がある。/Library/LaunchDaemons/limit.maxfiles.plist
/Library/LaunchDaemons/limit.maxfiles.plist
結論
badger
はサーバー用途にも使われるファイル・ベースの高速 DB です。しかし、QiiTrans のためだけに、ユーザーに.plist
の作成や権限付与といった操作をお願いするのは難しいです。また、256 ファイルの制限は、英文ベースのコントリビュートがメインの場合は、すぐに到達してしまうと思われます。かと言って DB サーバーを用意する規模でもないため、ここは素直に SQLite3 を使うのが得策と思われます。
参考情報
The text was updated successfully, but these errors were encountered: