Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

辞書が壊れてエンジンが起動しなくなる #623 の解決 #624

Merged
merged 4 commits into from
Feb 21, 2023

Conversation

Hiroshiba
Copy link
Member

内容

辞書周りにLockを2つ導入します。
user_dict.jsonの排他制御と、pyopenjtalkによる読み込みの排他制御です。

関連 Issue

close #623

その他

テスト用コマンド

for i in {1..10}; do
    curl -s -X POST "localhost:50021/user_dict_word" \
        --get \
        --data-urlencode "surface=test$i" \
        --data-urlencode "pronunciation=テスト" \
        --data-urlencode "accent_type=1" &
done
wait

@Hiroshiba Hiroshiba requested a review from a team as a code owner February 21, 2023 13:00
@Hiroshiba Hiroshiba requested review from y-chan and removed request for a team February 21, 2023 13:00
@Hiroshiba
Copy link
Member Author

何回かバグ報告頂いてたので、ついでにrelease-0.14のhotfixとして導入したいと思います。rebaseします

@github-actions
Copy link

github-actions bot commented Feb 21, 2023

Coverage Result

Resultを開く
Name Stmts Miss Cover
voicevox_engine/init.py 1 0 coverage-100%
voicevox_engine/acoustic_feature_extractor.py 75 0 coverage-100%
voicevox_engine/dev/synthesis_engine/init.py 2 0 coverage-100%
voicevox_engine/dev/synthesis_engine/mock.py 36 2 coverage-94%
voicevox_engine/full_context_label.py 162 3 coverage-98%
voicevox_engine/kana_parser.py 86 1 coverage-99%
voicevox_engine/metas/Metas.py 33 0 coverage-100%
voicevox_engine/metas/MetasStore.py 29 14 coverage-52%
voicevox_engine/metas/init.py 2 0 coverage-100%
voicevox_engine/model.py 145 9 coverage-94%
voicevox_engine/mora_list.py 4 0 coverage-100%
voicevox_engine/part_of_speech_data.py 5 0 coverage-100%
voicevox_engine/preset/Preset.py 12 0 coverage-100%
voicevox_engine/preset/PresetError.py 2 0 coverage-100%
voicevox_engine/preset/PresetManager.py 81 2 coverage-98%
voicevox_engine/preset/init.py 4 0 coverage-100%
voicevox_engine/synthesis_engine/init.py 5 0 coverage-100%
voicevox_engine/synthesis_engine/core_wrapper.py 206 166 coverage-19%
voicevox_engine/synthesis_engine/make_synthesis_engines.py 57 49 coverage-14%
voicevox_engine/synthesis_engine/synthesis_engine.py 130 11 coverage-92%
voicevox_engine/synthesis_engine/synthesis_engine_base.py 67 9 coverage-87%
voicevox_engine/user_dict.py 135 6 coverage-96%
voicevox_engine/utility/init.py 4 0 coverage-100%
voicevox_engine/utility/connect_base64_waves.py 37 0 coverage-100%
voicevox_engine/utility/mutex_utility.py 10 0 coverage-100%
voicevox_engine/utility/path_utility.py 26 6 coverage-77%
TOTAL 1356 278 coverage-79%

@Hiroshiba Hiroshiba force-pushed the 辞書周りをmutexに branch from 1541212 to 7ae56c6 Compare February 21, 2023 13:07
@Hiroshiba Hiroshiba changed the base branch from master to release-0.14 February 21, 2023 13:08
@Hiroshiba
Copy link
Member Author

うーん!
Linuxではうまく動いてたのですが、Windowsだとダメそうでした。

        with mutex_openjtalk_dict:
            shutil.move(tmp_dict_path, compiled_dict_path)

でパーミッションエラーが出ました。
おそらくmoveに時間がかかるかなにかなのかなと思っています。

関数全体をLockしてしまえば動作したのでとりあえず緊急的にそうしてみましたが、根本的解決ではない気がします。
まあでもとりあえず解決したのでマージしたいと思います!

@Hiroshiba
Copy link
Member Author

windowsでのGit Bashで単語を同時登録するコマンドメモ

surface="test"
pronunciation="テスト"
accent_type="1"

echo -n $pronunciation >text.txt

for i in {1..10}; do
    curl -s -X POST "localhost:50021/user_dict_word" \
        --get \
        --data-urlencode "surface=$surface$1" \
        --data-urlencode "[email protected]" \
        --data-urlencode "accent_type=$accent_type" &

done
wait

@Hiroshiba
Copy link
Member Author

うーん。。自信がないです。。
辞書周りお詳しそうな @takana-v さん、メンテナの @y-chan さんにもとりあえずお伝えだけ。。

mutex_wrapperというデコレータも作ってみたので、なにかに使えるかもです。

@Hiroshiba Hiroshiba merged commit 1cc7d58 into VOICEVOX:release-0.14 Feb 21, 2023
@Hiroshiba Hiroshiba deleted the 辞書周りをmutexに branch February 21, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

辞書が壊れてエンジンが起動しなくなる
1 participant