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

#856 regressed again on debug build due to absl::InitializeLog() in Windows #1077

Closed
yukawa opened this issue Oct 13, 2024 · 0 comments
Closed

Comments

@yukawa
Copy link
Collaborator

yukawa commented Oct 13, 2024

Description

In short, acaa7af reintroduced the following issue as it internally triggers RoInitialize().

Steps to reproduce

Steps to reproduce the behavior:

  1. Create and install a debug version of Mozc64.msi
  2. Build and launch the following app.
  3. Select Mozc
#include <windows.h>

int WINAPI wWinMain(HINSTANCE instance_handle, HINSTANCE prev_instance_handle,
                    PWSTR command_line, int command_show) {
  const wchar_t window_class_name[] = L"Test Window Class";
  {
    const WNDCLASS wc = {
        .lpfnWndProc = [](HWND window_handle, UINT message,
                          auto... params) -> LRESULT {
          if (message == WM_DESTROY) {
            ::PostQuitMessage(0);
            return 0;
          }
          return ::DefWindowProc(window_handle, message, params...);
        },
        .hInstance = instance_handle,
        .hbrBackground = (HBRUSH)(COLOR_WINDOW + 1),
        .lpszClassName = window_class_name,
    };
    ::RegisterClass(&wc);
  }

  const HWND window_handle = ::CreateWindowEx(
      0, window_class_name, L"Window Title", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
      CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr,
      instance_handle, nullptr);

  if (window_handle == nullptr) {
    return 0;
  }

  ::ShowWindow(window_handle, command_show);

  while (true) {
    MSG message = {};
    if (::GetMessage(&message, nullptr, 0, 0) <= 0) {
      break;
    }
    ::TranslateMessage(&message);
    ::DispatchMessage(&message);
  }

  return 0;
}

Expected behavior

The test app does not crash at the step 3.

Actual behavior

The test app crashes at the step 3.

Version or commit-id

1d74ac4

Environment

  • OS: Windows 11 23H2

Additional context

This does not affect release build as it is guarded with NDEBUG.

void RegisterLogFileSink(const std::string &path) {
#if !defined(NDEBUG) && !defined(__ANDROID__)
absl::InitializeLog();
absl::AddLogSink(new LogFileSink(path));
#endif // !NDEBUG && !__ANDROID__
}

yukawa added a commit to yukawa/mozc that referenced this issue Oct 14, 2024
This commit affects only mozc_tip{32,64}.dll build with debug mode.
There must be no behavior change in release build.

Currently 'Mozc_tsf_ui.log' is created only when NDEBUG is defined.
With this commit we stop creating it even when NDEBUG is defined.
This addresses a crash issue in debug builds discussed in google#1077.

See google#856 about why absl::LocalTimeZone cannot be used in Windows right
now.

Note that this commit may also help us diagnose google#1076, where
  Windows.Storage.OneCore.dll
looks to be intercepting certain Win32 file I/O API calls in
AppContainer processes then trigger RoInitialize as needed.
Creating 'Mozc_tsf_ui.log' only in debug builds can make our debugging
more complicated.
yukawa added a commit to yukawa/mozc that referenced this issue Oct 14, 2024
This commit affects only mozc_tip{32,64}.dll build with debug mode.
There must be no behavior change in release build.

Currently 'Mozc_tsf_ui.log' is created only when NDEBUG is defined.
With this commit we stop creating it even when NDEBUG is defined.
This addresses a crash issue in debug builds discussed in google#1077.

See google#856 about why absl::LocalTimeZone cannot be used in Windows right
now.

Note that this commit may also help us diagnose google#1076, where
  Windows.Storage.OneCore.dll
looks to be intercepting certain Win32 file I/O API calls in
AppContainer processes then trigger RoInitialize as needed.
Creating 'Mozc_tsf_ui.log' only in debug builds can make our debugging
more complicated.
hiroyuki-komatsu added a commit that referenced this issue Jan 16, 2025
2.30.5618 → 2.31.5712

Conversion
* Updated the LM dictionary
* Updated symbols (#1074, #1100)
* Updated emoji data to CLDR 46 (Emoji 16.0)
* Fixed conversion errors reported by users.

Bug fix
* Windows: fixed the freeze issue with some applications like the searchhost.exe (#1077, #856)
* Windows: fixed the UI language issue of the GUI tools (#1110)

Features
* Updated the copyright year to 2025.
* Windows: bundle debug symbol for Mozc TIP DLL (#1081)
* Windows: shutdown existing Mozc processes on upgrading the version (#1093)

Build
* supported Bazel 8.0.0 (#1118)
* removed WORKSPACE support for Bazel (#1115)
* supported Python 3.14 (#1084)
* updated the protobuf version: v27.3 → v29.1.
* Linux: supported gcc-14.1.1 without additional build flags (#927)
* macOS / Windows: Updated Qt version: 6.7.3 → 6.8.0 (#1105, #1110, #1121)

Code
* added a lint checker for BUILD.bazel and *bzl files (#1089)
* renamed the protobuf field from Candidates to CandidateWindow
* refactoring of ConversionRequest making it as immutable object
* refactoring of the Converter implementation
* refactoring of Engine and SessionConverter to make each module pluggable
* removed cyclic dependency between Converter and Rewriter.

PiperOrigin-RevId: 716215275
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

No branches or pull requests

1 participant