Skip to content

Conversation

@bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Feb 18, 2025

Host api calls now declare a Future variable from channel.send first. Then it awaits the future immedieately or inside of a async method.

Part of fixing webview_flutter_wkwebview issue: flutter/flutter#162437

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@bparrishMines bparrishMines changed the title Pigeon hostcall [pigeon] Fixes potential race condition caused by a ProxyApi constructor message call being made in an async method Feb 18, 2025
@bparrishMines bparrishMines marked this pull request as ready for review February 18, 2025 20:25
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM with nit.

Were you eventually able to repro it, or is it still speculative as to whether this is enough to fix the webview issue?

indent.format('''
final List<Object?>? ${varNamePrefix}replyList =
\t\tawait ${varNamePrefix}channel.send($sendArgument) as List<Object?>?;
\t\tawait ${varNamePrefix}sendFuture as List<Object?>?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable name (${varNamePrefix}sendFuture) should be a local variable used in the two places, since it needs to match.

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

looks good

@bparrishMines
Copy link
Contributor Author

bparrishMines commented Feb 18, 2025

@stuartmorgan I could only reproduce it when I added a Future.delayed to the ProxyApi constructor, but I would get the same error message that was provided in the issue. Besides that, its speculative.

I wasn't able to reproduce it without Future.delayed with debug, release, iOS 16.~, or iOS 18.3.1.

@bparrishMines bparrishMines added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 18, 2025
@auto-submit auto-submit bot merged commit eeecb3b into flutter:main Feb 18, 2025
82 checks passed
@bparrishMines bparrishMines deleted the pigeon_hostcall branch February 18, 2025 23:03
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 19, 2025
…constructor message call being made in an async method (flutter/packages#8656)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 19, 2025
…constructor message call being made in an async method (flutter/packages#8656)
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Feb 19, 2025
flutter/packages@cb4fb13...a9b9172

2025-02-19 [email protected] [google_maps_flutter] Platform
interface for camera animation duration (flutter/packages#8596)
2025-02-18 [email protected] [various] Update Pigeon for task
queue changes (flutter/packages#8654)
2025-02-18 [email protected] [pigeon]
Fixes potential race condition caused by a ProxyApi constructor message
call being made in an async method (flutter/packages#8656)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Feb 20, 2025
…he internal wrapper immediately sends constructor calls (#8657)

Potential solution to flutter/flutter#162437

As stated in #8656 (comment), I can only reproduce the crash when adding a delay in the async anonymous function. This should ideally prevent that crash by ensuring the send call is made before entering an async method.
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
…tor message call being made in an async method (flutter#8656)

Host api calls now declare a `Future` variable from `channel.send` first. Then it `await`s the future immedieately or inside of a async method.

Part of fixing webview_flutter_wkwebview issue: flutter/flutter#162437
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
…he internal wrapper immediately sends constructor calls (flutter#8657)

Potential solution to flutter/flutter#162437

As stated in flutter#8656 (comment), I can only reproduce the crash when adding a delay in the async anonymous function. This should ideally prevent that crash by ensuring the send call is made before entering an async method.
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…tor message call being made in an async method (flutter#8656)

Host api calls now declare a `Future` variable from `channel.send` first. Then it `await`s the future immedieately or inside of a async method.

Part of fixing webview_flutter_wkwebview issue: flutter/flutter#162437
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…he internal wrapper immediately sends constructor calls (flutter#8657)

Potential solution to flutter/flutter#162437

As stated in flutter#8656 (comment), I can only reproduce the crash when adding a delay in the async anonymous function. This should ideally prevent that crash by ensuring the send call is made before entering an async method.
Jyndigo pushed a commit to uesp/wkwebview_flutter that referenced this pull request Jun 24, 2025
…he internal wrapper immediately sends constructor calls (#8657)

Potential solution to flutter/flutter#162437

As stated in flutter/packages#8656 (comment), I can only reproduce the crash when adding a delay in the async anonymous function. This should ideally prevent that crash by ensuring the send call is made before entering an async method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: pigeon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants