Skip to content

[Windows] Panic in EventLoopThreadExecutor::execute_in_thread (Re-entrancy / Destroyed state) #1180

@kanatapple

Description

@kanatapple

Describe the bug
We are experiencing panics in our production environment (Tauri application) originating from tao::platform_impl::platform::event_loop::EventLoopThreadExecutor::execute_in_thread on the Windows backend.

Based on the panic messages, it appears to be related to internal state management within the Windows event loop runner, specifically involving re-entrancy checks or accessing the event loop state after it has been destroyed.

Steps To Reproduce
Steps to reproduce the behavior. It must use tao directly and not tauri.

  1. This issue is observed in a production Tauri application (v2.8.5).
  2. Due to the nature of the error (likely a race condition or specific timing during window destruction/heavy load), we have not been able to isolate a minimal reproduction using tao directly yet.
  3. However, the stack traces collected point directly to tao's internal logic on Windows, suggesting unsafe state transitions during the event loop processing.

Expected behavior
The event loop should handle state transitions gracefully. Even if an event handler is re-entrant or the state is destroyed, it should ideally not cause a hard panic that crashes the application.

Screenshots
N/A (See stack trace details in "Additional context")

Platform and Versions (please complete the following information):
OS: Windows 10.0.26100 x86_64
Rustc: 1.89.0
Tao version: 0.34.3

Additional context
We have identified three distinct panic messages/locations in the stack traces that seem to stem from the same root cause:

  1. Re-entrancy / No Handler:
    "either event handler is re-entrant (likely), or no event handler is registered (very unlikely)"
    Location: src/platform_impl/windows/event_loop/runner.rs:244

  2. Assertion Failure:
    "assertion failed: flush_paint_messages(None, &subclass_input.event_loop_runner)"
    Location: src/platform_impl/windows/event_loop.rs:2344

  3. Invalid State Transition:
    "cannot move state from Destroyed"
    Location: src/platform_impl/windows/event_loop/runner.rs:368

It appears that the event loop is attempting to access state or flush messages after the runner state has arguably become invalid or destroyed.


Full tauri info output:

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 144.0.3719.93
    ✔ MSVC:
        - Visual Studio Professional 2017
        - Visual Studio Professional 2019
    ✔ rustc: 1.89.0 (29483883e 2025-08-04)
    ✔ cargo: 1.89.0 (c24e10642 2025-06-23)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 22.14.0
    - yarn: 1.22.22
    - npm: 10.9.2

[-] Packages
    - tauri 🦀: 2.8.5
    - tauri-build 🦀: 2.4.1
    - wry 🦀: 0.53.3
    - tao 🦀: 0.34.3
    - @tauri-apps/api : 2.2.0
    - @tauri-apps/cli : 2.2.2

[-] Plugins
    - tauri-plugin-updater 🦀: 2.9.0
    - @tauri-apps/plugin-updater : not installed!
    - tauri-plugin-fs 🦀: 2.4.2
    - @tauri-apps/plugin-fs : not installed!
    - tauri-plugin-log 🦀: 2.7.0
    - @tauri-apps/plugin-log : not installed!
    - tauri-plugin-http 🦀: 2.5.2
    - @tauri-apps/plugin-http : not installed!
    - tauri-plugin-dialog 🦀: 2.4.0
    - @tauri-apps/plugin-dialog : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions