Improve backend stability and config tooling#880
Conversation
?? Gemini-Generated Code Review (Followed by my review)This code review was generated by Gemini, followed by my review. Pull Request #880 Review Report: EasyIME/PIMEThis report provides a comprehensive code review of PR #880. Executive SummaryPR #880 introduces major reliability, resilience, performance, and caching improvements across the codebase (Rust launcher, C++ client/service, Python server, and Web UI configurations). High-Impact Enhancements:
??? Critical Flaw Found: Infinite Orphaned Process Spawning LoopThere is a severe concurrency bug introduced/worsened in Technical Analysis:
Caution This infinite loop also triggers whenever a dead backend is removed from Proposed Fix:Ensure that Detailed File-by-File Analysis1.
|
|
Hi @omni624562 非常感謝貢獻,這些修改看起來大多不錯,但我還是使用 AI 輔助 code review 因為我個人不熟悉 rust,看起來 backend spawn process 確實有可能有問題,這部份能再修改一下嗎? 或是把這部份拆到別的 PR 我們先 merge 其餘部份。謝謝 |
Summary / 摘要
This PR extracts stability and performance-oriented fixes from WIME back to PIME, without WIME branding, mockups, installer-only changes, or the larger candidate window UI redesign.
此 PR 將 WIME 中較適合回饋給 PIME 的穩定性與效能修正獨立整理出來,不包含 WIME 品牌改名、mockup、限定 installer,或較大型的候選窗 UI 重構。
Changes / 變更內容
Improve
PIMELauncherbackend startup responsiveness by avoiding holding the async state lock while spawning a backend.改善
PIMELauncher啟動 backend 時的反應速度,避免在 spawn backend 時持有 async state lock,降低其他 client 被阻塞的機會。Run Python backends unbuffered and flush protocol replies to reduce typing latency.
讓 Python backend 以 unbuffered 模式執行,並在送出 protocol 回應時 flush,降低打字延遲。
Avoid protocol parsing allocations in backend output handling.
優化 backend output 的 protocol parsing,避免不必要的配置。
Make C++ RPC handling more tolerant of missing JSON fields and absent
showCandidates.讓 C++ RPC 處理對缺少 JSON 欄位或沒有
showCandidates的回應更具容錯性。Reduce pipe reconnect wait time and increase pipe read buffer size.
縮短 pipe 重新連線等待時間,並增加 pipe read buffer 大小。
Recreate the overlapped I/O event after pipe resets.
pipe reset 後會重新建立 overlapped I/O event,避免一次斷線後後續 RPC 難以恢復。
Keep the Python backend alive after one malformed or failing request, with regression tests.
Python backend 遇到單次 malformed 或失敗 request 後會繼續運作,並加入 regression tests。
Harden cinbase config loading/saving so shipped defaults are layered under user settings and internal state is not persisted.
強化 cinbase 設定讀寫,先載入內建預設值再覆蓋使用者設定,並避免內部狀態被寫入設定檔。
Reset cinbase loading flags even when loading threads fail.
即使 cinbase 載入 thread 發生錯誤,也會正確重設 loading flag,避免輸入法永久停在載入狀態。
Fix New Chewing config tab switching and static file cache refresh behavior.
修正新酷音設定頁 tab 切換,以及靜態檔快取造成設定頁更新不即時的問題。
Allow config tools to save intentionally empty symbol/keyboard data.
允許設定工具儲存刻意清空的符號或鍵盤資料。
Validation / 驗證
python -m py_compile python\server.py python\cinbase\config.py python\cinbase\__init__.py python\cinbase\configtool.py python\input_methods\chewing\config_tool.pypython -m unittest tests.test_backend_resiliencerustfmt --edition 2021 --check src\main.rs src\backend_manager.rs src\protocol.rscargo checkinPIMELauncherPIMETextServiceRelease builds with Visual Studio 2022/CMake使用 Visual Studio 2022/CMake 成功建置 x86 與 x64
PIMETextServiceRelease 版本。