Skip to content
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

shouldInterceptRequest is not called on main thread (android) causing UB + race conditions #1379

Open
jkelleyrtp opened this issue Oct 3, 2024 · 0 comments

Comments

@jkelleyrtp
Copy link

jkelleyrtp commented Oct 3, 2024

Describe the bug

The mechanism driving handleRequest on android has an unsafe impl Sync bound that allows it to be called from shouldInterceptRequest.

However, this is wrong, since shouldInterceptRequest is not called from the main thread:

Note: This method is called on a thread other than the UI thread so clients should exercise caution when accessing private data or the view system.

https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)

This is causing dioxus to segfault, locks to fail, RC to double-drop, etc.

This function should instead use a channel to block until the response is ready from the main thread.

It's likely there are more functions being called from not-the-main-thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant