Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26425

iOS: Crash in unregisterTimer with 'pointer being freed was not allocated'

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.4.1
    • Component/s: None
    • Environment:
    • Sprint:
      2018 Sprint 20 SDK

      Description

      This is a critical crash that is affecting the deployment of our application. It happens frequently and it is because something is trying to clean up a timer that no longer exists.

      When the app crashes there are around 560-650 threads, with a similar number of timers. The majority of the timers have a duration of 50.

      The timer cannot be traced back to anything in our code. Our code sets up two intervals that stick around for the lifetime of the app:

      • id of 19 for duration of 15000 for server keep alive
      • id of 20 for duration of 30000 for google analytics
        We have another interval with a duration of 300000 that is cleared and recreated and keeps track of payment device connection.

      Exception Type:        EXC_CRASH (SIGABRT)
      Exception Codes:       0x0000000000000000, 0x0000000000000000
      Exception Note:        EXC_CORPSE_NOTIFY
       
      Application Specific Information:
      abort() called
      *** error for object 0x7fcc402ce600: pointer being freed was not allocated
       
      CoreSimulator 518.22 - Device: iPad Air 2 - Runtime: iOS 11.4 (15F79) - DeviceType: iPad Air 2
       
      Thread 26 Crashed:
      0   libsystem_kernel.dylib        	0x000000011793eb66 __pthread_kill + 10
      1   libsystem_pthread.dylib       	0x0000000117978080 pthread_kill + 333
      2   libsystem_c.dylib             	0x0000000117599c97 abort + 127
      3   libsystem_malloc.dylib        	0x00000001176d54da free + 521
      4   com.apple.CoreFoundation      	0x00000001163e906b mdict_rehashd + 315
      5   com.apple.CoreFoundation      	0x00000001163e7285 mdict_removeObjectForKey + 469
      6   com.*************.ea            	0x000000010c793420 -[KrollContext unregisterTimer:] + 240 (KrollContext.m:879)
      7   com.*************.ea            	0x000000010c7a1e83 -[KrollTimer cancel] + 195 (KrollTimer.m:59)
      8   com.*************.ea            	0x000000010c7a239a -[KrollTimer main] + 890 (KrollTimer.m:138)
      9   com.apple.Foundation          	0x000000010f6803b3 __NSThread__start__ + 1221
      10  libsystem_pthread.dylib       	0x0000000117975661 _pthread_body + 340
      11  libsystem_pthread.dylib       	0x000000011797550d _pthread_start + 377
      12  libsystem_pthread.dylib       	0x0000000117974bf9 thread_start + 13
      

      588 threads at the time of crash with the majority of them looking like this:

      Thread 17:
      0   libsystem_kernel.dylib        	0x000000011793ea16 __psynch_cvwait + 10
      1   libsystem_pthread.dylib       	0x00000001179765c2 _pthread_cond_wait + 789
      2   com.apple.Foundation          	0x000000010f6c5771 -[NSCondition waitUntilDate:] + 143
      3   com.*************.ea            	0x000000010c7a2138 -[KrollTimer main] + 280
      4   com.apple.Foundation          	0x000000010f6803b3 __NSThread__start__ + 1221
      5   libsystem_pthread.dylib       	0x0000000117975661 _pthread_body + 340
      6   libsystem_pthread.dylib       	0x000000011797550d _pthread_start + 377
      7   libsystem_pthread.dylib       	0x0000000117974bf9 thread_start + 13
      

      <property name="run-on-main-thread" type="bool">true</property>

      Changing to false for the above seems to help with the issue. Is there a problem with run-on-main-thread being set to false? I see that in a new blank project you are setting this to true and I want to understand the issues that might arise with using false.

        Attachments

        1. Screen Shot 2018-09-17 at 11.58.04 AM.png
          866 kB
          Christy Thomas
        2. Screen Shot 2018-09-18 at 12.50.03 PM.png
          759 kB
          Christy Thomas

          Activity

            People

            • Assignee:
              jvennemann Jan Vennemann
              Reporter:
              cthomas Christy Thomas
              Reviewer:
              Vijay Singh
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6605
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code