google / mozc

Mozc - a Japanese Input Method Editor designed for multi-platform
Other
2.32k stars 330 forks source link

You may see an error dialog when you first enable Mozc while `mozc_server` is not running in Windows #839

Closed yukawa closed 8 months ago

yukawa commented 8 months ago

Description

Due to a regression in 3b6185f4fdf408bc9e630a1951a8938aba730111, you might have seen an error dialog when you first enable Mozc while mozc_server is not running in Windows.

Steps to reproduce

  1. Build Mozc for Windows
  2. .\out_win\Release\Mozc64.msi
  3. notepad.exe
  4. Select Mozc as the current IME.
  5. Tries to enable Mozc

Expected behavior

No error dialog is shown after the step 5.

Actual behavior

After the step 5, you may see the following error dialog.

cannot_start_conversion_engine

Version or commit-id

3b6185f4fdf408bc9e630a1951a8938aba730111 and any later version

Environment

Investigations

The root cause is that SpawnSandboxedProcessImpl in win_sandbox.cc no longer sets the spawned process ID to pid after 3b6185f4fdf408bc9e630a1951a8938aba730111. https://github.com/google/mozc/blob/006084cf4e3a31a37f48a55c7d4a73790ce39dfb/src/base/win32/win_sandbox.cc#L635-L664

As a result, ServerLauncher::StartServer gets confused and thinks it's failed to launch mozc_server and the error dialog should be shown.

Here it's guaranteed to fall into PROCESS_SIGNALED block when pid is 0. https://github.com/google/mozc/blob/006084cf4e3a31a37f48a55c7d4a73790ce39dfb/src/ipc/named_event.cc#L162-L174 https://github.com/google/mozc/blob/006084cf4e3a31a37f48a55c7d4a73790ce39dfb/src/client/server_launcher.cc#L197-L214