KERN_INVALID_ADDRESS at 0x0000000000000000

23,610

EXC_BAD_ACCESS usually happens because you are sending an Obj-C message to an invalid memory address, what means that you probably are trying to access some deallocated object.

It may be working on other devices because this object is not being released at the same time.

I recently had a similar crash that happened because there was a timer not being invalidated on dealloc, and when the target method was called, that object did no longer exist.

You could try to enable NSZombie objects and see if you find which object is being deallocated. In xCode 6, you can enable them in Product > Scheme > Edit scheme > Diagnostics > Enable Zombie Objects.

Also, there are lots of these kind of errors that NSZombieEnabled can't detect. Unfortunately there is nothing magical to solve it. The second option would be to run your app with instruments (memory leaks specifically) and see if you can get something. If this doesn't work you will have to review your code and check that there are no possibilities that you are trying to access a deallocated object. Hope it helps.

Good luck!

Share:
23,610
Mahesh
Author by

Mahesh

iOS Developer

Updated on October 23, 2020

Comments

  • Mahesh
    Mahesh over 3 years

    I have developed an iPad application using Xcode 6.3.2. I submitted my application to the App Store for review where it was reject due to crash.Following is the crash report from iTunes.

    Incident Identifier: 88DD7F94-3382-4241-A0D7-C3E7F6D20737
    CrashReporter Key:   9881ae0cc3b3fbfccfd0ce1496d2fa08fec08782
    Hardware Model:      xxx
    
    Path:                /private/var/mobile/Containers/Bundle/Application/FDBBD67F-0EF7-43FB-80CB-8308A10A2D29/Vehicle Visuals.app/Vehicle Visuals
    Identifier:          com.vehiclevisuals.Vehicle-Visuals
    Version:             2.0.0 (1.1.0)
    Code Type:           ARM-64 (Native)
    Parent Process:      launchd [1]
    
    Date/Time:           2015-06-12 12:33:57.988 -0700
    Launch Time:         2015-06-12 12:22:14.581 -0700
    OS Version:          iOS 8.3 (12F69)
    Report Version:      105
    
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
    Triggered by Thread:  0
    
    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0 Crashed:
    0   libobjc.A.dylib                 0x0000000195da7bdc 0x195d8c000 + 113628
    1   QuartzCore                      0x00000001889fdc2c 0x1889ec000 + 72748
    2   Vehicle Visuals                 0x0000000100126828 0x1000ec000 + 239656
    3   Vehicle Visuals                 0x0000000100101e80 0x1000ec000 + 89728
    4   UIKit                           0x0000000189118778 0x1890a4000 + 477048
    5   UIKit                           0x0000000189116750 0x1890a4000 + 468816
    6   UIKit                           0x0000000189112000 0x1890a4000 + 450560
    7   UIKit                           0x00000001890b175c 0x1890a4000 + 55132
    8   QuartzCore                      0x00000001889f9e18 0x1889ec000 + 56856
    9   QuartzCore                      0x00000001889f4880 0x1889ec000 + 34944
    10  QuartzCore                      0x00000001889f4724 0x1889ec000 + 34596
    11  QuartzCore                      0x00000001889f3eb8 0x1889ec000 + 32440
    12  QuartzCore                      0x00000001889f3c38 0x1889ec000 + 31800
    13  UIKit                           0x0000000189137f8c 0x1890a4000 + 606092
    14  UIKit                           0x0000000189137ef0 0x1890a4000 + 605936
    15  CoreFoundation                  0x000000018462c2a0 0x18454c000 + 918176
    16  CoreFoundation                  0x000000018462922c 0x18454c000 + 905772
    17  CoreFoundation                  0x000000018462955c 0x18454c000 + 906588
    18  CoreFoundation                  0x00000001845552d0 0x18454c000 + 37584
    19  GraphicsServices                0x000000018dc436f8 0x18dc38000 + 46840
    20  UIKit                           0x000000018911afa8 0x1890a4000 + 487336
    21  Vehicle Visuals                 0x000000010013a1cc 0x1000ec000 + 319948
    22  libdyld.dylib                   0x0000000196412a04 0x196410000 + 10756
    
    Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
    

    As per the report it crashes on OS Version : iOS 8.3 (12F69). I tested my app on the all simulators(iPad Air, iPad 2, iPad Retina) with same config(iOS version 8.3 (12F69)) and also tested it on my device (iPad mini) with iOS version 8.3 (12F69), but didn't crashed on my side. But it crashes on my friend's iPad Air with same iOS version (it gives the same crash report with different invalid address as below)

    Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000020 Triggered by Thread: 0

    I don't have the iPad Air so that I could debug using the device.

    I also tried to Symbolicated crash report using following command.

    xcrun atos -o VehicleVisuals 0x0000000000000020

    But it just gives me following hex code.

    0x00000020 (in VehicleVisuals)

    I following Link for symbolication.

    I'm just not being able to recognise where actually is the crash issue. Please can anybody help me out?

    • Phillip Mills
      Phillip Mills almost 9 years
      Try atos on the stack addresses associated with your code instead: 0x0000000100126828 and 0x0000000100101e80.
    • Mahesh
      Mahesh almost 9 years
      @PhillipMills Gives me following result : xcrun atos -o VehicleVisuals 0x0000000100101e80 encodingTable (in VehicleVisuals) + 4660
    • Mahesh
      Mahesh almost 9 years
      @PhillipMills My app name is "Vehicle Visuals" so when running atos it gave me error "atos cannot load symbols for the file VehicleVisuals for architecture armv7s.". So I renamed it to VehicleVisuals, does it make effect while running the atos?
    • Jan ATAC
      Jan ATAC almost 9 years
      Reminds me a bug I had. Did you use XCode to submit your project to iTunes Connect ? If so, use App Loader to see if it crashes also...
    • Mahesh
      Mahesh almost 9 years
      @CanATAC Yes I used Xcode to submit the project to iTunes Connect.
    • Jan ATAC
      Jan ATAC almost 9 years
      Ok try App Loader instead and tell us if it works..
  • Mahesh
    Mahesh almost 9 years
    I have already enabled the NSZombie object to trace the EXC_BAD_ACCESS. Thing is that its not crashing on either of the simulators that I'm testing on, nor is it crashing on my hardware device (iPad mini). It crashes on iPad Air of the client to whom I send the app through Test Flight. If I could reproduce the issue on my side it would be easy for me to resolve it.
  • Gemma del Olmo
    Gemma del Olmo almost 9 years
    Yes, there are lots of these kind of errors that NSZombieEnabled can't detect. Unfortunately there is nothing magical to solve it. The second option would be to run your app with instruments (memory leaks specifically) and see if you can get something. If this doesn't work you will have to review your code and check that there are no possibilities that you are trying to access a deallocated object. Hope it helps. This kind of errors are sometimes the hardest to debug.
  • Mahesh
    Mahesh almost 9 years
    Thanks for the reply. I had actually figured out the issue and now it works fine. I actually had to test it on iPad Air to figure out where actually EXC_BAD_ACCESS occurred :)
  • Raghav
    Raghav over 8 years
    @Mahesh: you can put the solution here as what was root cause of the issue you faced and resolution for it.