-
Notifications
You must be signed in to change notification settings - Fork 54
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
zbus panic on Linux #227
Comments
Please provide the output of |
It's not (just) transitive - I use zbus with the tokio feature in my project. Looking at the zbus executor code, it seems extremely fragile in this case? Switching between |
Then I suppose accesskit_unix needs to have async-io and tokio features, and work with both runtimes. @DataTriny Can you look into this? @lunixbochs Just curious, what project are you using this in? If you can't share, no worries. |
zbus still feels really fragile here, I'm now worried something else in my dep tree will have the same problem. zbus can only work if everything in your dependency tree uses the same executor, this is clearly a bug in the zbus api/design :(
I'm porting the core app/ui in Talon from Qt to Rust (egui) + a cool actor model system I built for UI + a handful of custom crates for stuff like better tray icon/menu and clipboard support to bring things up to par with my Qt codebase. I'm hoping to not regress on screen reader support in the process, as Qt native windows come with accessibility integration for free. FWIW here are my results so far trying latest accesskit with egui in Talon (I'm on latest winit and I patched egui to use latest accesskit):
Speaking of winit, you should consider tweaking your objc2 version to allow the |
@lunixbochs I'd like to work with you to debug the macOS issue. Where would be a convenient place for us to chat about that, so we don't clutter this issue? |
The Talon slack? |
@lunixbochs OK, I'm on the Talon Slack now. I don't know how to find you there, but you should be able to DM me, or mention me on an appropriate channel if you prefer. |
Hi there, I already suggested adding But actually doing it is tricky. We rely on zbus
The easiest (and maybe cleanest) way to solve this I see right now would be to offer both a blocking and an async API. If we want to keep a purely blocking API, I don't see how we could detect wether the caller:
Providing both a blocking and an async API would require significant changes under the hood, but we don't have many public function so the scope is quite narrow. |
Winit is currently a synchronous runloop, and the only way for me to really own a winit Window is on the winit main thread in the synchronous runloop. Even though I have tokio code, it's not on this thread. I suspect most windows are going to be managed on synchronous runloops for the same reason. So it might make the most sense for accesskit to run its own executor. |
As a workaround, I think we should add a I think the more complicated answer would be to make a public async api for accesskit so the user can manage this themselves, but I kind of doubt many people will want to provide an async executor for their synchronous window event loop. |
Responding to this question from the PR:
I make an app (foo). I use two crates (A, B) that internally use zbus. Using both crate A and crate B in this way at the same time, regardless of which one you were using first, panics on the synchronous thread inside zbus. This happens because the async crate B enables the zbus tokio feature, which assumes it's always safe to spawn tokio tasks inside zbus. You likely can't make synchronous calls into zbus if any crate in your entire tree enables the zbus tokio feature, but synchronous calls into zbus are safe otherwise! That's what happened here, and it's clearly a zbus bug in my eyes. GUI apps generally aren't going to be running UI code inside a tokio runloop, because they're already in something like a winit runloop. So zbus will just generally have this problem in UI code. That's a problem for accesskit, because accessibility is inherently a UI thing. The zbus synchronous api with |
I get this panic when opening a winit window that creates an AccessKit adapter on Linux.
This is executing in the winit main thread. I called
accesskit_winit::Adapter::with_action_handler
from my own code.The text was updated successfully, but these errors were encountered: