16 Replies
      Latest reply on May 14, 2020 12:43 PM by RandyHill
      greay Level 1 Level 1 (0 points)

        When I try to run my iOS app through the Leaks instrument in the simulator, very shortly after launch, without fail, it will stop with the error "An error occurred trying to capture Leaks data"

         

        All the disclosure says is "Error retrieving leak information." I can't find any other information. Checking the console view, it just shows a normal run up until "<End of Run>"

         

        I've tried doing a clean build, deleting my derived data, uninstalling the app from the simulator, restarting Xcode, rebooting. I have no idea what to do.

        • Re: "an error occurred trying to capture leaks data"
          w3sip Level 1 Level 1 (0 points)

          I have the same error -- runs for a little bit, then errors out. Also, can't attach to a running process anymore.

           

          What gives, Apple?

          • Re: "an error occurred trying to capture leaks data"
            LaurieM44 Level 1 Level 1 (0 points)

            Same error for me here but for a macos app on xcode 12.2. I have the error "An error occurred trying to capture Leaks data" after a couple of seconds running in Instruments.

            • Re: "an error occurred trying to capture leaks data"
              Dalzhim Level 1 Level 1 (0 points)

              I have experienced the same issue. Here are some more details :

               

              Allocations instrument: Failed to attach to target: Failed to attach to target process.

              Leaks instrument: An error occurred trying to capture Leaks data

              Time Profiler instrument: Runs perfectly fine

               

              One workaround I have used is to profile in debug rather than release by changing the scheme configuration : Edit Scheme > Profile > Info > Build Configuration.

              • Re: "an error occurred trying to capture leaks data"
                ding0039 Level 1 Level 1 (0 points)

                Same error for me

                • Re: "an error occurred trying to capture leaks data"
                  dwarfland Level 1 Level 1 (0 points)

                  Same here, two different MacBooks (Cataline GM and latest Cataline beta, respectively), Xcode 11.0, 11.1 and 11.2.1. Instrunments either "cannot attach" or "cannot load tracking library" or beachballs or it "runs" but the (macOS) app never shows (though the process in `ps`). Essentially Instruments is entirely and literally unusable, which is really annoying and a productivity problem. (Instrument has been getting bad for a while, but at least it stil *ran* in Xcode 9/10).

                   

                  Wondering if Apple in 2019 is capable of touching any part of its software catalog without just breaking it beyond repair...

                  • Re: "an error occurred trying to capture leaks data"
                    sadfadsf Level 1 Level 1 (0 points)

                    I run into the same error, Xcode 11.2.1, even it happens of Xcode 10 as well

                    • Re: "an error occurred trying to capture leaks data"
                      O_G Level 1 Level 1 (0 points)

                      Did anyone figure out this problem? I'm having the same problem. Instruments flat out won't work with the Simulator.

                       

                      I'm on the latest Xcode, latest Simulator, latest macOS.

                       

                      How do you fix this? I'm going crazy.

                        • Re: "an error occurred trying to capture leaks data"
                          kacperh_ Apple Staff Apple Staff (10 points)

                          Hi there!

                          Newly available Xcode 11.4 Beta 3 should have the fix. We release noted it:

                          Fixed an issue in the iOS 13.4 Simulator runtime where applications wouldn’t launch using the Allocations and Leaks templates. (56543962) (FB7403237)

                           

                          Can you please let me know if you still see the issue?

                           

                          Thank you and sorry for your troubles!

                           

                          Kacper

                            • Re: "an error occurred trying to capture leaks data"
                              O_G Level 1 Level 1 (0 points)

                              @kacperh It's still broken.

                               

                              EDIT:

                               

                              Actually it's worse now. Before, SOMETIMES it would show the app loading screen for a brief time (even though no code would run).

                               

                              Now it instantly fails every time.

                               

                              If launched in Allocations:

                              > An error occurred trying to capture Allocations data.

                               

                              If launched in Leaks:

                              > An error occurred trying to capture Allocations data.

                               

                              No matter what this is all I get. It happens in Xcode 10.3, 11.3, and all betas of 11.4.

                               

                              I am assuming this is a problem specific to Catalina since I had no problems prior to updating to Catalina.

                               

                              From other research I did, someone suggested this could be due to a provisioning profile or signing problem. But this is an Apple product—it should just work. I have no problems building and running the app in general.

                               

                              The only other thing I could think of is that I have Sentinel One endpoint security installed, as well as CrowdStrike Falcon and GlobalProtect. Is there any way in which any of these products could be interfering? I noticed that the Xcode 11.4 beta 2 patch notes said something about "certain" third-party endpoint security packages causing issues with the simulator etc. Please advise.

                               

                              UPDATE:

                               

                              Here are some of the errors from my console:

                               

                              default18:26:46.598314-0800kernelLibrary load (/Users/O.G/Develop/ios/DerivedData/OurApp/Build/Products/Debug-iphonesimulator/OurFramework.framework/OurFramework) rejected: Library load disallowed by System Policy

                               

                              memorystatus_control(MEMORYSTATUS_CMD_GET_MEMLIMIT_PROPERTIES, 67221) failed: using 0/1, 0/1

                               

                              Port death watcher fired.

                               

                              default19:25:55.483797-0800com.apple.dt.instruments.dtsecurityCode validity check error: Error Domain=NSOSStatusErrorDomain Code=-67050 "(null)"

                               

                              The signing certificate and provisioning profile were refreshed and the problem still did not go away.

                               

                              I honestly believe the problem is that our app has over 50 framework dependencies and takes too long to launch, resulting in Instruments giving up on it. I say this, because I have once or twice gotten the app to launch with Instruments, and a freshly created test app worked fine with Instruments.

                               

                              Either that or there is some kind of gatekeeper-related issue around loading frameworks? I don't know. Happy to provide more logs if it would help, never had this problem prior to 10.15.3.

                              • Re: "an error occurred trying to capture leaks data"
                                kacperh_ Apple Staff Apple Staff (10 points)

                                Hi O_G,

                                 

                                I think I saw your post yesterday saying it doesn't work with the new 11.4 Beta but I can't see it now. Can you please confirm if using 11.4 Beta Instruments with iOS 11.4 simulator runtime works for you?

                                 

                                Thank you.

                                 

                                Best,

                                 

                                Kacper

                                  • Re: "an error occurred trying to capture leaks data"
                                    O_G Level 1 Level 1 (0 points)

                                    Yes I am using Xcode 11.4 Beta 3, Xcode 11.4 Beta 3 Instruments.

                                     

                                    As for "iOS 11.4 simulator" -- do you mean iOS 13.4...? Or do you want me to try it on the old iOS 11.4 simulator?

                                     

                                    It never works with iOS 11.4 simulator.

                                     

                                    With iOS 13.4 simulator it does not work the first couple of times, but on the third or fourth try it finally starts working.

                                     

                                    If I use a dummy app instead of our huge app, then it seems to work every time. Our huge app however has over 50 frameworks that load at runtime and I think that maybe it takes too long? Not sure.

                                     

                                    BTW You can't see my post because it says it's in moderation. No idea why, maybe because I pasted logs into it?

                                      • Re: "an error occurred trying to capture leaks data"
                                        kacperh_ Apple Staff Apple Staff (10 points)

                                        Yes, I meant iOS 13.4 simulator — sorry about the typo.

                                        We'll take a look at logs. Do you mind filing it for us as a feedback report and attaching sysdiagnose? If you could do it and pass me number afterwards — that would be perfect.

                                         

                                        Thank you and sorry for your troubles with this!

                                          • Re: "an error occurred trying to capture leaks data"
                                            O_G Level 1 Level 1 (0 points)

                                            The question is, why doesn't Xcode 11.3 or 10.3 work with their respective versions of Instruments anymore?

                                             

                                            Is this 10.15.3 Catalina being a Nazi about stuff? I'm on the verge of disabling SIP and deleting any files related to gatekeeper out of my System volume if this kind of thing keeps up.

                                             

                                            I will see if I can find the time to do a sysdiagnose and all that.

                                             

                                            I mean, I just want to know why this is happening. Even vaguely. If I knew that much, then at least I could have a chance of helping to figure out a solution.

                                             

                                            But there is so much constant, irrelevant spam in the macOS console, how can you ever find the legit warnings?

                                             

                                            Why is it like that?

                                             

                                            Incidentally I also cannot make in-memory graphs of programs anymore. The connection gets dropped or something.

                                            • Re: "an error occurred trying to capture leaks data"
                                              O_G Level 1 Level 1 (0 points)

                                              When trying to do a memory graph on a pre-iOS 13 simulator I get:

                                              “Memory Graph Debugger: no serialized memory graph received from LeakAgent” error when using Xcode Memory Graph Debugger

                                               

                                              Corresponding with these console log messages :

                                              LeakAgent - Failed to create CSSymbolicatorRef for pid 23018 AppName

                                              LeakAgent - *** task_malloc_get_all_zones: can't get target task symbolicator

                                               

                                              I believe the bug is with the pre-iOS 13 simulators and Catalina. Please fix!

                                               

                                              (This stackoverflow confirms: https://stackoverflow.com/a/59133500/12587089)

                                              • Re: "an error occurred trying to capture leaks data"
                                                aditya.tirodkar Level 1 Level 1 (0 points)

                                                Wanted to follow up on this - it looks like this failure persists for iOS 12x simulators even now when running the leaks tool from the command line in both Xcode 11.3.1 and 11.4.1.

                                                 

                                                Was there any update on a fix or any feedback that has been published already?