Skip to content

Fatal issue when handler #59

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

Open
jeromediaz opened this issue Sep 3, 2020 · 3 comments
Open

Fatal issue when handler #59

jeromediaz opened this issue Sep 3, 2020 · 3 comments

Comments

@jeromediaz
Copy link
Contributor

On the following piece of code

[ping startPingingWithBlock:^(GBPingSummary *summary) {
if (!ping) {
return;
}
resolve(@(@(summary.rtt * 1000).intValue));
[ping stop];
ping = nil;
} fail:^(NSError *_Nonnull error) {
if (!ping) {
return;
}
reject(@(error.code).stringValue,error.domain,error);
[ping stop];
ping = nil;
}];

there is a flaw: there is no guarantee the resolve (or reject) call will be finished before the second ping arrive, which would result on a fatal issue as those handlers can only be called once

those handlers should either :

  • be call asynchronously,
  • be called after [ping stop]

for those encountering the issue before it is corrected, you can handle the ping answer in js using a
setTimeout(() => { // do your stuff} , 0)

@Edrick-Koch
Copy link

I think im stuck on this. Trying to ping multiple in a promise all array cause memory leak, but Im not sure where to put the setTimeout your refer to?

@RoJoHub
Copy link
Owner

RoJoHub commented Jul 28, 2022

This is really a fatal problem, I want to fix this in the next release

@prakashw3expert
Copy link

Hi @jeromediaz @RoJoHub , I'm getting same fatal error.App is crashing after some time in production due to GBPing.listonce. Is is fixed or still pending ?

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

No branches or pull requests

4 participants