6 Replies
      Latest reply on Jul 7, 2018 5:27 AM by cmsj
      cmsj Level 1 Level 1 (0 points)

        I have a Mac app and when I want to profile it for leaks, I get an error "Unable to acquire required task port" from Instruments. I can't really find anyone else with this issue on the web, but it must be something to do with my application because I see the same thing on both Xcode 9.3 on High Sierra, and Xcode 10 on the first Mojave developer preview, each on separate Macs.

         

        Any suggestions?

        • Re: Unable to use Leaks in Instruments
          cwoolf Apple Staff Apple Staff (0 points)

          Are you trying to profile an app that's installed or on that you're building via Xcode?

            • Re: Unable to use Leaks in Instruments
              latenitefilms Level 1 Level 1 (0 points)

              I'm also having the same issue as @cmsj, when trying to profile an app that's being built via Xcode.

               

              The app in question is Hammerspoon - you can download the source code here: http://www.hammerspoon.org

              I'm running macOS 10.13.5 on a MacBook Pro (15-inch, 2017) with Xcode 9.4.1.

              The error I get is:

              An error occurred trying to capture Leaks data.
              Unable to acquire required task port (7824:0)

               

              Any ideas @cwoolf?

              • Re: Unable to use Leaks in Instruments
                cmsj Level 1 Level 1 (0 points)

                Building in Xcode. The app is opensource if someone wants to try and reproduce the failure - https://github.com/Hammerspoon/hammerspoon

                • Re: Unable to use Leaks in Instruments
                  cmsj Level 1 Level 1 (0 points)

                  (I think my reply got moderated for having a URL in it)

                   

                  I'm building the app in Xcode using Product->Profile.

                   

                  If it helps, the app is open source. It lives on GitHub in Hammerspoon/hammerspoon (note that to build it you need to pip install -r requirements.txt for something the docs need)

                    • Re: Unable to use Leaks in Instruments
                      cwoolf Apple Staff Apple Staff (0 points)

                      It's been a while since I had to troubleshoot a problem like this, but you might want to check that:

                      1.)  Your provisioning profile is installed on the device, and it matches with app ID you're trying to profile.

                      2.)  Your "Release" configuration (or whatever configuration you are using with the Profile action) is signed with a "developer" ID.  If it's signed with a "distribution" ID, it will prevent debugging and profiling.

                        • Re: Unable to use Leaks in Instruments
                          cmsj Level 1 Level 1 (0 points)

                          Aha! It's definitely some kind of signing issue. We are signing with a Developer ID, because the app is distributed outside the MAS, but if I disable signing, I'm able to run the Leaks profile.

                           

                          Unfortunately, this is all complicated by us doing our signing in a Build Phases script (so fresh github checkouts by people other than me, can build immediately). Hopefully I can find an environment variable that will let me skip signing if the build is for Instruments!

                           

                          Thanks very much for your replies