Skip to content

fix(mobile): avoid mutex deadlocks - #15491

Merged
Legend-Master merged 3 commits into
tauri-apps:devfrom
bclarke123:fix/mobile-ipc-mutex
Jun 6, 2026
Merged

fix(mobile): avoid mutex deadlocks#15491
Legend-Master merged 3 commits into
tauri-apps:devfrom
bclarke123:fix/mobile-ipc-mutex

Conversation

@bclarke123

Copy link
Copy Markdown
Contributor

This PR removes potential deadlocks when multiple threads call IPC commands concurrently on iOS / Android - in Tauri 2.9 there are four surfaces where this issue can manifest, and in 2.11 one of them has been fixed (ios run_command). This PR fixes the other three to acquire locks before entering if let Some(handler) = ... to avoid deadlocks on device, which are hard to trace and give the impression of instability.

One note, these changes introduce two .cloned() calls on Channel structs - these are Arc-backed, and so these clones should be cheap, and are required to release the locks on CHANNELS / PENDING_PLUGIN_CALLS before sending to the WebView.

@bclarke123
bclarke123 requested a review from a team as a code owner June 6, 2026 01:23
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 0011c5c

There are 5 changes which include tauri-utils with patch, tauri with patch, tauri-bundler with patch, tauri-cli with patch, @tauri-apps/cli with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-utils 2.9.2 2.9.3
tauri-bundler 2.9.2 2.9.3
tauri-runtime 2.11.2 2.11.3
tauri-runtime-wry 2.11.2 2.11.3
tauri-codegen 2.6.2 2.6.3
tauri-macros 2.6.2 2.6.3
tauri-plugin 2.6.2 2.6.3
tauri-build 2.6.2 2.6.3
tauri 2.11.2 2.11.3
@tauri-apps/cli 2.11.2 2.11.3
tauri-cli 2.11.2 2.11.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Legend-Master
Legend-Master previously approved these changes Jun 6, 2026

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bclarke123

Copy link
Copy Markdown
Contributor Author

Will do!

@bclarke123
bclarke123 force-pushed the fix/mobile-ipc-mutex branch from 19844c4 to dd1649d Compare June 6, 2026 08:45
@Legend-Master Legend-Master changed the title Fix (iOS / Android): Avoid mutex deadlocks fix(mobile): avoid mutex deadlocks Jun 6, 2026

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Legend-Master
Legend-Master merged commit 66f873d into tauri-apps:dev Jun 6, 2026
19 checks passed
Proksima pushed a commit to Proksima/tauri that referenced this pull request Aug 5, 2026
* Avoid mutex deadlocks by acquiring locks outside of `if let`

* Add .changes

* Rename change-pr-15491 to mobile-run-command-deadlock.md

---------

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants