You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Elijah R (JIRA)" <ji...@apache.org> on 2018/04/06 20:51:00 UTC

[jira] [Created] (CB-14020) cordova-plugin-geolocation crashes with "Collection was mutated while being enumerated"

Elijah R created CB-14020:
-----------------------------

             Summary: cordova-plugin-geolocation crashes with "Collection was mutated while being enumerated"
                 Key: CB-14020
                 URL: https://issues.apache.org/jira/browse/CB-14020
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-geolocation
    Affects Versions: Master
         Environment: iOS 11
cordova-ios@4.3.1
cordova-plugin-geolocation@2.4.2

Although I am running an older version, this issue does not appear to be fixed in the latest plugin version as the relevant code has not been changed.

The javascript in my app is making multiple calls to `navigator.geolocation.getCurrentPosition()` in rapid succession.
            Reporter: Elijah R
         Attachments: crash-log.txt

There is a race condition in CDVLocation.m.  The self.locationData.locationCallbacks array can be mutated in one thread and enumerated concurrently in another thread, which causes the app to crash with the following exception:

Fatal Exception: NSGenericException
*** Collection <__NSArrayM: 0x1d444d020> was mutated while being enumerated.

The exception is raised at [CDVLocation returnLocationError:withMessage:] (CDVLocation.m:312)

I am unable to reproduce the issue, however it is a common crash for users of my app.  A user named seeday on github has opened a pull request to address this issue: https://github.com/apache/cordova-plugin-geolocation/pull/91

I'm filing this bug to help get that work merged.

I've attached an abridged crash log with the relevant stack trace.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org