Skip to content

fix(linux): remove harmful request loading workaround#1605

Merged
lucasfernog merged 2 commits into
tauri-apps:devfrom
dgerhardt:remove-webkitgtk-request-workaround
Aug 27, 2025
Merged

fix(linux): remove harmful request loading workaround#1605
lucasfernog merged 2 commits into
tauri-apps:devfrom
dgerhardt:remove-webkitgtk-request-workaround

Conversation

@dgerhardt
Copy link
Copy Markdown
Contributor

@dgerhardt dgerhardt commented Aug 19, 2025

With the introduction of the multi webview unstable feature in #359, a workaround for request loading during webview initialization was added for an unknown concurrency bug in WebKitGTK. This PR now removes it because it has negative side effects and does not seem to be needed anymore:

  • it introduces a deadlock situation (partially mitigated by fix(linux): deadlock in WebViewUriLoader #1561),
  • it disables parallel loading when initializing multiple webviews, and
  • the bug can no longer be reproduced using current WebKitGTK versions.

The workaround does not seem to have ever been intended to be a long term solution (FIXME comment). Unfortunately, there is no issue linked for the underlying issue and no reproduction was provided, which makes it hard to tell if the bug still exists with newer versions of WebKitGTK. But I have not been able to reproduce the issue on Ubuntu 24.04 using libwebkit2gtk-4.1-0@2.48.3-0ubuntu0.24.04.1. In the worst case scenario, this would cause a regression on an unstable feature while still fixing and improving webview loading in general on Linux.

This PR provides an alternate solution for #1562, which instead introduces a feature flag to opt out of the workaround.

Original description of the workaround:

Prevents an unknown concurrency bug with loading multiple URIs at the same time on webkit2gtk.

Using the queue prevents data race issues with loading uris for multiple [WebView]s in the
same context at the same time. Occasionally, the one of the [WebView]s will be clobbered
and it's content will be injected into a different [WebView].

Example of webview-c clobbering webview-b while webview-a is okay:

webview-a triggers load-change::started
URISchemeRequestCallback triggered with webview-a
webview-a triggers load-change::committed
webview-a triggers load-change::finished
webview-b triggers load-change::started
webview-c triggers load-change::started
URISchemeRequestCallback triggered with webview-c
URISchemeRequestCallback triggered with webview-c
webview-c triggers load-change::committed
webview-c triggers load-change::finished

In that example, webview-a will load fine. webview-b will remain empty as the uri was
never loaded. webview-c will contain the content of both webview-b and webview-c
because it was triggered twice even through only started once. The content injected will not
be sequential, and often is interjected in the middle of one of the other contents.

FIXME: We think this may be an underlying concurrency bug in webkit2gtk as the usual ways of
fixing threading issues are not working. Ideally, the locks are not needed if we can understand
the true cause of the bug.

Closes tauri-apps/tauri#12589
Refs #359

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 19, 2025

Package Changes Through 12a48ee

There are 1 changes which include wry 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
wry 0.53.2 0.53.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

The `WebViewUriLoader` is a workaround for an unknown concurrency bug in
WebKitGTK. It is now removed because
* it introduces a deadlock situation,
* it disables parallel loading when initializing multiple webviews, and
* the bug can no longer be reproduced using current WebKitGTK versions.

Closes tauri-apps/tauri#12589
Refs tauri-apps#359
@dgerhardt dgerhardt force-pushed the remove-webkitgtk-request-workaround branch from ca0c1b2 to 8188d35 Compare August 19, 2025 15:58
Copy link
Copy Markdown
Member

@lucasfernog lucasfernog left a comment

Choose a reason for hiding this comment

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

looks like it still works, let's see if something comes up.

@chippers please let us know if you still can reproduce the bug or if you have a reproduction example out there still :D

@lucasfernog lucasfernog merged commit 0f51d67 into tauri-apps:dev Aug 27, 2025
20 checks passed
@chippers
Copy link
Copy Markdown
Member

looks like it still works, let's see if something comes up.

@chippers please let us know if you still can reproduce the bug or if you have a reproduction example out there still :D

i think i have a video of it, because i remember making a video of my test case opening dozens of windows in a tiling manner on my 4k monitor to try and reproduce it (only sometimes), but it's been so long idk where it is or the test suite i made for it. if i find it ill post it but if it's no longer needed, that's good :)

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.

[bug] Opening a WebviewWindow after closing one breaks further Webview creation on Linux

3 participants