Skip to content

A failed AT-SPI connection panics (unwrap in run_event_loop) #727

Description

@ogoffart

On Linux, accesskit_unix connects to the AT-SPI bus on a background thread. If that connection fails for any reason, the error is unwrap'd:

// src/context.rs, get_or_init_messages()
run_event_loop(&executor, session_bus, rx).await.unwrap();

With panic = "abort", that aborts the whole process, so the app crashes on startup just because an optional accessibility connection failed. The inner error varies by environment (Handshake("Server GUID mismatch …"), NotFound, or InterfaceNotFound.

This became easy to hit in accesskit_unix 0.22.0, which changed the gate from ScreenReaderEnabled to IsEnabled:

// 0.21.1
let changes = status.receive_screen_reader_enabled_changed().await.fuse();
// 0.22.0
let changes = status.receive_is_enabled_changed().await.fuse();

IsEnabled is true on a normal desktop even with no screen reader, so AccessKit now connects for nearly every app, and any unreachable AT-SPI bus crashes it.

In my case, I observed this when cargo update upgraded to accesskit 0.33.1 and therefore accesskit_unix 0.22.
As a developer i might have an unconventional setup and i do run several sessions for tests and things and got panic on all my slint apps panicked at accesskit_unix-0.22.0/src/context.rs:61:78: called `Result::unwrap()` on an `Err` value: Handshake("Server GUID mismatch: expected 7ed5678e88c8df9526ef139d6a1b354e, got 0c1e09f80bf08973a2020b806a366325")

Reproduce

# a bus that doesn't exist (misconfiguration)
export AT_SPI_BUS_ADDRESS="unix:path=/tmp/no-such-a11y-bus,guid=00000000000000000000000000000000"

cargo run -p accesskit_winit --example simple
thread '<unnamed>' panicked at accesskit_unix-0.22.0/src/context.rs:61:
called `Result::unwrap()` on an `Err` value:
InputOutput(Os { code: 2, kind: NotFound, message: "No such file or directory" })

Expected

A failed AT-SPI connection should be logged and accessibility disabled for the session; the app keeps running.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions