question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ios: debug mode produces endless loop in notification handling

See original GitHub issue

Your Environment

  • Plugin version: 3.1.0
  • Platform: iOS
  • OS version: 13.1
  • Device manufacturer and model:
  • Running in Simulator: Yes
  • Cordova version (cordova -v): Capacitor 1.3.0
  • Cordova platform version (cordova platform ls):
  • Plugin configuration options: debug: true, desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY, saveBatteryOnBackground: true
  • Link to your project:

Context

In CDVBackgroundGeolocation, the notification delegate gets set:

center.delegate = self;

Immediately afterwards, in debug mode, this value gets stored in prevNotificationDelegate:

prevNotificationDelegate = center.delegate;
center.delegate = self;

When handling the notification, it calls always the handler of prevNotificationDelegate (which is self). This leads to and endless loop.

Expected Behavior

Notification should be handled in debug mode as well.

Actual Behavior

App crashes.

Possible Fix

IMHO prevNotificationDelegate is completely useless. Probably you can just remove it. Or at least call it only, if it != self.

Steps to Reproduce

Context

Debug logs

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
jackie-dcommented, Mar 18, 2020

Related to: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/645 https://github.com/mauron85/cordova-plugin-background-geolocation/pull/633

The latest and this one explain the issue details really well and address the fix. Any maintaner or iOs dev to open a PR?

Temporary solution: disable debug mode in config

this.backgroundGeolocation.configure({
  // ...
  debug: false
  // ...
});
1reaction
jackie-dcommented, Mar 18, 2020

This still happens with @mauron85/cordova-plugin-background-geolocation@~3.1.0 + "@ionic-native/background-geolocation": "^5.22.0".

Schermata 2020-03-18 alle 12 26 39

Also system log reports: Service exited due to SIGSEGV | sent by exc handler[27280] (segmentation fault due to too much recursion)

The fix proposed by @Ritzlgrmft it’s mandatory to keep the iOs version working, otherwise it will just crash at start.

Is there any way to disable the notification?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to debug infinite loop "crash" in Xcode for iOS involving ...
But the non-crash - it's an infinite loop - occurs when the search results table is being displayed / updated, after a call...
Read more >
Loop that works in debug but not release. - Apple Developer
This code works fine in debug mode, but invariably crashes in release mode. The values have all been used previously in the loop,...
Read more >
How to debug infinite loop "crash" in Xcode for iOS involving ...
Coding example for the question How to debug infinite loop "crash" in Xcode for iOS involving CALayer and view layout during search?
Read more >
Infinite loop of "callbacks_poll" #1538 - realm/realm-js - GitHub
This is used only in debugging to be able to support handling arbitrary callbacks called from the device side. This method is called...
Read more >
Debugging Auto Layout feedback loops - Hacking with Swift
Here's how to try it out: Go to the Product menu, hold down Option, and choose “Run…”
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found