xpc creates hundreds of threads (was: Beta 5 hanging up mail after a while on Yosemite) Libmacgpg #142 ✔

Joerg's Avatar


09 Mar, 2015 05:00 AM

I've now seen this several times:
After using beta 5 for a while I eventually run into a mail that doesn't show (it looks like it keeps loading). These are always mails containing a PGP signature, I believe.

After that, Mail is no longer usable. If I quit and re-start mail it won't start but hand while launching.

I don't really see anything in the logs, I once did have a crash and that showed it was crashing somewhere in GPGTools or GPGMail, Sorry, I don't have the log anymore.

Uninstalling GPGTools fixes it and I can also reinstall, but it reliably comes back after a day or two of use.

This way GPGMail is not usable with Yosemite right now.

Beta 5, latest Yosemite updates.

  1. 1 Posted by spamfaenger on 09 Mar, 2015 08:25 AM

    spamfaenger's Avatar

    I'm having the same issue, it seems that killing the org.gpgtools.Libmacgpgp.xpc service recovers mail without me having to force quit it.

    I've attached two spin dumps, one of mail, and one of the service

  2. 2 Posted by David P on 09 Mar, 2015 04:33 PM

    David P's Avatar

    Having the same problem. Latest beta, installed manually. Also experiencing a strange new effect: Mail now BCC's me on some outgoing messages, sporadically. No pattern, and across multiple accounts. Verified it is not set in prefs. Never saw that before installing GPGtools.

  3. 3 Posted by spamfaenger on 10 Mar, 2015 11:34 AM

    spamfaenger's Avatar

    Do you need more information to work on this? I can still reproduce this fairly reliably. :/

  4. 4 Posted by Joerg on 26 Mar, 2015 10:16 PM

    Joerg's Avatar

    This issue still exists in Beta 6!

  5. Support Staff 5 Posted by Luke Le on 27 Mar, 2015 10:23 AM

    Luke Le's Avatar

    Hi Martin,

    this is indeed a very strange issue. The spin dump shows a huge amount of thread basically idling (waiting for a condition). Since you are able to reproduce this, could you post some steps leading up to the problem?

    That would be really helpful.

  6. 6 Posted by spamfaenger on 27 Mar, 2015 04:49 PM

    spamfaenger's Avatar

    Hi Luke,

    sorry, but I don't have a stable reproduction yet.

    I can say, that it seems to happen after I leave mail in the background for a longer time.

    But that's sadly not that great a reproduction advice. :/

    Cu Martin

  7. 7 Posted by Joerg on 27 Mar, 2015 04:52 PM

    Joerg's Avatar

    I also don't really have a way to reproduce but it seems to hang on signing a mail I'm trying to send.

    That said... this might be wrong and that's just when I notice it, in that case it might happen when a newly incoming mail has it's signature checked in the background.

  8. Support Staff 8 Posted by Luke Le on 01 Apr, 2015 04:59 PM

    Luke Le's Avatar

    Hi Joerg,

    could you also try to create a sample log when this happens the next time.
    Maybe a pattern emerges.


  9. 9 Posted by Joerg on 01 Apr, 2015 05:08 PM

    Joerg's Avatar

    Yes, I'll try.

  10. 10 Posted by Joerg on 03 Apr, 2015 05:55 PM

    Joerg's Avatar

    OK, I've created two more spindumps.
    The obvious issue that's visible is that the service created 514 threads which looks wrong for signing a single mail :)

  11. 11 Posted by Joerg on 07 Apr, 2015 03:51 AM

    Joerg's Avatar

    OK, another data point. It really looks like any threads created by gpgtools are never really shut down. I can see the number of threads continuously rising and whenever the 514 thread threshold is reached the tool and mail locks up.

  12. 12 Posted by Tobi on 14 Apr, 2015 06:51 PM

    Tobi's Avatar

    I also have the same issue. After a few days working with Mail the app crashed during sending of a new message. There is no chance to reopen Mail app after terminating. Only a reboot solves the issue to open up Mail.

  13. 13 Posted by spamfaenger on 15 Apr, 2015 09:50 AM

    spamfaenger's Avatar

    Since 10.10.3 came around, Mail is now just hanging directly after it started, from the spin dump it seems that communication with the gpg helper is the culprit.

    -- snip -- 1000 -[GPGOptions valueForKey:inDomain:] + 137 (Libmacgpg + 60262) [0x10cca3b66] 1000 -[GPGOptions valueInGPGAgentConfForKey:] + 27 (Libmacgpg + 63537) [0x10cca4831] 1000 -[GPGOptions gpgAgentConf] + 135 (Libmacgpg + 64947) [0x10cca4db3] 1000 -[GPGConf initWithPath:andDomain:] + 200 (Libmacgpg + 90177) [0x10ccab041] 1000 -[GPGConf loadConfig] + 53 (Libmacgpg + 88340) [0x10ccaa914] 1000 -[GPGConf loadConfigFileXPC] + 78 (Libmacgpg + 89846) [0x10ccaaef6] 1000 -[GPGTaskHelperXPC loadConfigFileAtPath:] + 171 (Libmacgpg + 133128) [0x10ccb5808] 1000 -[GPGTaskHelperXPC waitForTaskToCompleteAndShutdown:throwExceptionIfNecessary:] + 43 (Libmacgpg + 132178) [0x10ccb5452] 1000 semaphore_wait_trap + 10 (libsystem_kernel.dylib + 70938) [0x7fff9166a51a] *1000 semaphore_wait_continue + 0 (kernel + 1357760) [0xffffff800034b7c0] -- snap --

  14. 14 Posted by David Mery on 18 Apr, 2015 11:12 AM

    David Mery's Avatar

    Only a reboot solves the issue to open up Mail.

    No, after force quitting Mail if necessary, you just need to open the Activity Monitor, search for gpg and kill the org.gpgtools.Libmacgpg.xpc process.

  15. 15 Posted by Tamas Gal on 22 Apr, 2015 08:53 AM

    Tamas Gal's Avatar

    Yes, always do the process kill via Activity Monitor, since if there is a Mail in "sending process", it gets lost of you force quit Mail.app. This happened to me several times and is still happening, since Mail.app often starts this infinite loop when I send a message.

    This is a very critical bug since mails are not sent and even vanish if you quit Mail or restart your Mac without noticing that gpg hangs.

  16. 16 Posted by HO Meyer on 22 Apr, 2015 07:01 PM

    HO Meyer's Avatar

    The same happens with Beta 6: Mail hangs repeatedly after a while of use (half a day). It tries to display mail contents, but doesn't succeed. The mails stay empty.
    I killed it, but on restart, it only shows the beachball of death.
    After I disabled the GPGMail.mailbundle by moving it into a dummy folder, Mail starts without any flaws.
    So it seems clear to me which is the guilty process.

  17. Support Staff 17 Posted by Luke Le on 22 Apr, 2015 07:43 PM

    Luke Le's Avatar


    unfortunately we're still not able to reproduce this issue.
    By now, the cuprit definitely seems to be our xpc service.
    Are all of you using MacGPG2 or are some of you using gnupg self-compiled or from homebrew/macports/fink?

    It would be great if we could debug this issue on one of your computers directly the next time it happens. Would anyone be willing to try that? (Pre-requisite is having Xcode installed)

  18. 18 Posted by Joerg on 22 Apr, 2015 07:51 PM

    Joerg's Avatar

    What exactly does "we could debug this" mean?
    I do have XCode installed and I see that this is simply an ongoing (permanent) issue: threads never stop so they simply accumulate until they reach the 514 threshold and then the whole thing locks up.

    So the underlying issue is there permanently.

    So if you want me to debug anything, if you could give me very detailed instructions I might be able to do that.

    If MacGPG is the GPG version that comes with GPGTools: yes, that's what I'm using.

  19. 19 Posted by David on 22 Apr, 2015 08:36 PM

    David's Avatar

    Similarly to Joerg, I have XCode installed and have installed via GPGTools. Happy to help, however I'm not familiar with XCode as I've installed it mainly for the command line compiler to use with Macports so detailed instructions would be needed.

  20. 20 Posted by Tamas Gal on 22 Apr, 2015 10:28 PM

    Tamas Gal's Avatar

    As a Mac developer, I may help out too, so just let me know…

  21. Support Staff 21 Posted by Luke Le on 23 Apr, 2015 12:15 AM

    Luke Le's Avatar

    Hi all,

    thank you very much for your help. Not sure how it happened, but a few hours ago, I was finally able to reproduce the problem (it randomly started occurring on my laptop)
    The bug should be fixed and the fix is included in the latest nightly.

    Could you please download and install our latest nightly build from the following URL and let us know if the problem is solved?

    Disclaimer: This is a development version which has not been thoroughly tested yet - bugs or crashes are to be expected. Thanks for helping us test.

  22. 22 Posted by Joerg on 23 Apr, 2015 03:03 AM

    Joerg's Avatar

    Hi, thanks for the fix.
    While it's obviously still a bit early for a definite statement I do see that now the Libmacgpg process does reduce the number of active threads during operation, something it didn't do before so yes, looks promising.

    What was the problem?

  23. 23 Posted by Tamas Gal on 23 Apr, 2015 10:15 AM

    Tamas Gal's Avatar

    Ah, the good old retain cycle. I just looked at the commit… The nightly is installed and I'll report! Cheers

  24. Support Staff 24 Posted by Luke Le on 23 Apr, 2015 10:59 AM

    Luke Le's Avatar

    @Tamas: yes exactly. Once we confirmed that was the culprit it's an easy fix. Xcode analyze didn't catch it. I also believe this is an edge case, while in other cases it wouldn't be a problem.

  25. 25 Posted by David on 23 Apr, 2015 09:46 PM

    David's Avatar

    So far with the nightly (Version: 2.5b6 (7bf389b) Build: 932n), it's been working fine.

  26. Support Staff 26 Posted by Steve on 21 Jul, 2015 10:05 PM

    Steve's Avatar

    Glad, this is solved for you. I'm closing this discussion. If you need further assistance or have questions you can re-open this discussion here or open a new one any time.

    Best, steve

  27. Steve closed this discussion on 21 Jul, 2015 10:05 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac