Closed crazecoder closed 2 years ago
Seems like we were never able to reproduce it #29092 (comment).
If anyone has a reduced reproduction project, we could take a look.
It happens all the time with sms autofill package when hot reloading.
the line that makes the error happen is this one:
Future<String> get hint async {
final String version = await _channel.invokeMethod('requestPhoneHint');
return version;
}
Basically when hot reloading multiple time, the hint to get user phone number appears multiple times and makes the app crash
I'm retitling to make it clearer what the original report was, and I'm going to hide a lot of off-topic discussion to make it less confusing.
To be very clear: It is not the case that any instance of Reply already submitted
is this issue.
Result
response method more than once.
Just removing the 2nd result.success() solved the problem
- If you find that your logic is correct, and have multiple in-flight method channel requests at the same time, that would be where this issue would be relevant.
@stuartmorgan Can you please explain what you mean by this part? We have checked our logic and feel pretty confident we are not calling a result's response more than once. Are you saying that two of the same requests would cause this error??
See the original issue description at the top of this page; the reported issue is that having two asynchronous method channel requests in flight at the same time could cause this error. (We haven't verified this yet, but that's the reported issue that's being tracked here.)
@gaaclarke was it intentional to register the handler for the [method channel twice] in (https://github.com/gaaclarke/double_result/blob/master/android/src/main/java/com/example/double_result/DoubleResultPlugin.java)?
cc @GaryQian will be taking a look
We are assigning 0
response_id for platform messages that return null/void. This is causing conflict if two messages are passed before the first one has a chance to complete and consume the zero response_id. https://github.com/flutter/engine/blob/master/shell/platform/android/platform_view_android.cc#L230
@gaaclarke was it intentional to register the handler for the [method channel twice] in (https://github.com/gaaclarke/double_result/blob/master/android/src/main/java/com/example/double_result/DoubleResultPlugin.java)?
@blasten I'm not sure. I wrote this a long time ago. Since it was me trying to reproduce a reported bug, it may be possible i was intentionally doing something wrong.
Reopening until we confirm this issue has been fixed in the wild.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Steps to Reproduce
flutter
android
example
Logs
An error is reported when two methods are executed at the same time