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

Remove timeouts for platform method calls #171

Closed
ben-xD opened this issue Sep 16, 2021 · 2 comments · Fixed by #172
Closed

Remove timeouts for platform method calls #171

ben-xD opened this issue Sep 16, 2021 · 2 comments · Fixed by #172
Labels
bug Something isn't working. It's clear that this does need to be fixed.

Comments

@ben-xD
Copy link
Contributor

ben-xD commented Sep 16, 2021

We have timeouts for futures when making method calls to the platform side:

.timeout(Timeouts.initializeTimeout, onTimeout: () {
_initializer = null;
throw TimeoutException(
'Initialization timed out.',
Timeouts.initializeTimeout,
);
});

and

onTimeout: () {
_handle = null;
throw TimeoutException(
'Acquiring handle timed out.',
Timeouts.acquireHandleTimeout,
);
},
).then((value) => (_handleValue = value)!);

This is timeout is not helpful, and in fact hurts developer experience (including users). They are not able to debug/ place use breakpoints properly, because the platform method times out. Additionally, slower devices platform method calls will naturally be slower. This has caused poor developer experience for me, and users in the past, for example: #72

  • If a method channel or WidgetsBinding is not initialised early enough, you will get No implementation found for method MethodName, immediately.
  • If the Dart VM is not initialized, then the entire app would not be running. This code would not be running either.
  • If something catastrophic was happening, then that is the problem.

There is no reason to support having this timeout. I would call it a bug, because users cannot debug their applications properly or run this app on a slow device (in theory).

In #72 (comment), QuintinWillison asked

What do other libraries do to solve this?

The answer is that other libraries do not have timeouts at all, there is no reason to arbitrarily kill a platform method after any amount of seconds. So they don't actually face this problem.

I have discussed this a bit with @tiholic, thank you :).

┆Issue is synchronized with this Jira Bug by Unito

@ben-xD ben-xD added the bug Something isn't working. It's clear that this does need to be fixed. label Sep 16, 2021
@jamienewcomb
Copy link
Member

@ben-xD should this be closed?

@ben-xD
Copy link
Contributor Author

ben-xD commented Oct 28, 2021

@ben-xD should this be closed?

Yes, thanks @jamienewcomb

@ben-xD ben-xD closed this as completed Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed.
Development

Successfully merging a pull request may close this issue.

2 participants