Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

/usr/libexec/lsd using 100% of CPU

Hi everybody,


I recently upgraded to 10.11 on my MacBook Pro (Retina, 15-inch, Mid 2014), 2,8 GHz Intel Core i7. I've been hearing my fan spin up quite a lot after the upgrade and found some things to behave odd, e.g. Firefox would not start up any longer and terminal windows would hang the whole system. When I looked at the output of "ps aux" I noticed that a (to me) new process /usr/libexec/lsd is consuming 100% of the CPU all the time.


Can someone enlighten me what this process does (maybe part of launchd?) and what I can possibly do about this, or whether someone has had similar behavior? By the way, this process restarts itself after killing it.


Thanks so much in advance,

fr_

MacBook Pro (Retina, 15-inch, Mid 2014), OS X El Capitan (10.11)

Posted on Oct 4, 2015 11:27 AM

Reply
10 replies

Oct 4, 2015 2:19 PM in response to fr_

Please read this whole message before doing anything.

This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.

Step 1

The purpose of this step is to determine whether the problem is localized to your user account.

Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”

While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.

Test while logged in as Guest. Same problem?

After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.

*Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.

Step 2

The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.

Please take this step regardless of the results of Step 1.

Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem.

Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.

Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.

The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.

Test while in safe mode. Same problem?

After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

Oct 4, 2015 12:25 PM in response to fr_

Some more info I could dig out. It seems to be stuck somewhere in _LSCreateRegistrationData. Is this due to it scanning for Application code signing?


DiagnosticReports root# cat lsd_2015-10-04-201230_nyrn.cpu_resource.diag

Date/Time: 2015-10-04 20:10:58 +0200

OS Version: Mac OS X 10.11 (Build 15A284)

Architecture: x86_64

Report Version: 19


Command: lsd

Path: /usr/libexec/lsd

Version: ??? (???)

Parent: launchd [1]

PID: 1353


Event: cpu usage (microstackshots only)

Thread: 0x2058 (99% cpu over 91 seconds)

Duration: 91.00s

Steps: 93


Hardware model: MacBookPro11,3

Active cpus: 8


Fan speed: 3327 rpm



Powerstats for: lsd [1353] thread 0x2058

UUID: F34D18C5-0C41-3C6D-A5A0-E3635C7746CA

Start time: 2015-10-04 20:10:59 +0200

End time: 2015-10-04 20:12:28 +0200

Parent: launchd

Microstackshots: 69 samples (74%)

Primary state: 58 samples Non-Frontmost App, Kernel mode, Thread QoS User Initiated

User Activity: 0 samples Idle, 69 samples Active

Power Source: 69 samples on Battery, 0 samples on AC

69 start_wqthread + 13 (libsystem_pthread.dylib) [0x7fff90f85375]

69 _pthread_wqthread + 1129 (libsystem_pthread.dylib) [0x7fff90f874f2]

69 _dispatch_worker_thread3 + 91 (libdispatch.dylib) [0x7fff95559b48]

69 _dispatch_root_queue_drain + 538 (libdispatch.dylib) [0x7fff95559d9b]

69 _dispatch_queue_invoke + 549 (libdispatch.dylib) [0x7fff955616c9]

69 _dispatch_queue_drain + 754 (libdispatch.dylib) [0x7fff9555b083]

69 _dispatch_client_callout + 8 (libdispatch.dylib) [0x7fff95556453]

69 _dispatch_call_block_and_release + 12 (libdispatch.dylib) [0x7fff955618ff]

69 -[LSServerDelegate dispatchMessage:withConnection:] + 281 (LaunchServices) [0x7fff8acffc0b]

69 -[LSDXPCServer registerItemInfo:withConnection:Action:] + 1327 (LaunchServices) [0x7fff8ad03c0a]

69 _LSCreateRegistrationData + 2307 (LaunchServices) [0x7fff8ad6ed2b]

69 _LSAddEntitlementsToDictionary(__CFURL const*, __CFDictionary*) + 111 (LaunchServices) [0x7fff8acfdb91]

69 SecStaticCodeCreateWithPath + 238 (Security) [0x7fff96d4b358]

69 Security::CodeSigning::DiskRep::bestGuess(char const*, Security::CodeSigning::DiskRep::Context const*) + 111 (Security) [0x7fff96d4e0c1]

69 Security::CodeSigning::BundleDiskRep::BundleDiskRep(char const*, Security::CodeSigning::DiskRep::Context const*) + 222 (Security) [0x7fff96d4423c]

69 Security::CodeSigning::BundleDiskRep::setup(Security::CodeSigning::DiskRep::Con text const*) + 1036 (Security) [0x7fff96d446ee]

69 Security::CodeSigning::DiskRep::bestFileGuess(char const*, Security::CodeSigning::DiskRep::Context const*) + 130 (Security) [0x7fff96d4e32e]

69 Security::CodeSigning::DiskRep::bestGuess(char const*, Security::CodeSigning::DiskRep::Context const*) + 317 (Security) [0x7fff96d4e18f]

69 Security::CodeSigning::MachORep::MachORep(char const*, Security::CodeSigning::DiskRep::Context const*) + 390 (Security) [0x7fff96d5c356]

69 Security::Universal::Universal(Security::UnixPlusPlus::FileDesc, unsigned long, unsigned long) + 787 (Security) [0x7fff96e332d1]

64 pread + 10 (libsystem_kernel.dylib) [0x7fff8d7fa462]

6 <User mode>

3 Security::UnixPlusPlus::FileDesc::read(void*, unsigned long, unsigned long) + 11 (Security) [0x7fff96e34597]

3 <User mode>

2 <User mode>


Binary Images:

0x1075a6000 - 0x1075a6fff lsd (728.4) <F34D18C5-0C41-3C6D-A5A0-E3635C7746CA> /usr/libexec/lsd

0x7fff8acbe000 - 0x7fff8ade3ff7 com.apple.LaunchServices 728.4 (728.4) <78774CB9-B206-360F-BC9F-2ACA69811814> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchS ervices.framework/Versions/A/LaunchServices

0x7fff8d7e2000 - 0x7fff8d800fff libsystem_kernel.dylib (3247.1.106) <7DD242A1-E2BF-39D1-8787-B174046E4F15> /usr/lib/system/libsystem_kernel.dylib

0x7fff90f84000 - 0x7fff90f8dff7 libsystem_pthread.dylib (137.1.1) <1373D0F1-C6CA-364E-A6BA-8BDBD0D34670> /usr/lib/system/libsystem_pthread.dylib

0x7fff95554000 - 0x7fff95581fff libdispatch.dylib (500.1.5) <6B38497E-9448-3433-9D6B-6223F2A99431> /usr/lib/system/libdispatch.dylib

0x7fff96c80000 - 0x7fff96efdffb com.apple.security 7.0 (57336.1.9) <E44CA10F-E1E2-3DC5-BCF3-EF76649A0918> /System/Library/Frameworks/Security.framework/Versions/A/Security



Oct 5, 2015 3:51 AM in response to fr_

It seems i have found the solution to this problem.


It was an Oculus Rift DK2 test app called CyberSpace.app that resided in my Downloads folder. Using "lsof" and the stacktrace I was able to find that the /usr/libexec/lsd process most likely was trying to generate a code signing object using https://developer.apple.com/library/mac/documentation/Security/Reference/CodeSig ningRef/#//apple_ref/c/func/SecStaticCod…


After removing the application from Downloads and killing the lsd process it eventually stopped using CPU resources and resumed operations normally.


If you ever encounter this problem I would recommend running lsof looking for the lsd process started by the currently logged in user.

pgrep -u `id -u` lsd | xargs lsof -p

If you see it having opened a .app file indefinitely, remove said .app file.


That said, to me it looks like a bug in lsd to try and generate code signing objects for certain programs.

Dec 6, 2015 2:26 AM in response to fr_

Hi fr_


the same problem appeared at my server and the result of your pgrep ... command is:


COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

lsd 3161 bladmin cwd DIR 1,27 1258 2 /

lsd 3161 bladmin txt REG 1,27 17728 406961 /usr/libexec/lsd

lsd 3161 bladmin txt REG 1,27 26280400 411595 /usr/share/icu/icudt55l.dat

lsd 3161 bladmin txt REG 1,27 3813376 2499627 /private/var/folders/kv/2kk40mdx5wdccb6hb7y3sgk80000gn/0/com.apple.LaunchServic es-134501.csstore

lsd 3161 bladmin txt REG 1,27 638336 406131 /usr/lib/dyld

lsd 3161 bladmin txt REG 1,27 553816338 446514 /private/var/db/dyld/dyld_shared_cache_x86_64

lsd 3161 bladmin 0r CHR 3,2 0t0 346 /dev/null

lsd 3161 bladmin 1u CHR 3,2 0t0 346 /dev/null

lsd 3161 bladmin 2u CHR 3,2 0t203 346 /dev/null

lsd 3161 bladmin 3u KQUEUE count=2, state=0x12


Unfortunately I can not identify any app, which is an object of code signing activity. Would you expect that the app name appears anywhere in the list above or do you have another way to identify the app-source?

From the call hierarchy code signing is the activity, which causes the hang in my case, too:


Analysis of sampling lsd (pid 11075) every 1 millisecond

Process: lsd [11075]

Path: /usr/libexec/lsd

Load Address: 0x106d85000

Identifier: lsd

Version: 728.4

Code Type: X86-64

Parent Process: launchd [1]



Date/Time: 2015-12-06 10:03:29.773 +0100

Launch Time: 2015-12-05 13:45:14.030 +0100

OS Version: Mac OS X 10.11.1 (15B42)

Report Version: 7

Analysis Tool: /usr/bin/sample

----



Call graph:

2652 Thread_869907 DispatchQueue_1: com.apple.main-thread (serial)

+ 2652 start (in libdyld.dylib) + 1 [0x7fff9a0dd5ad]

+ 2652 _LSServerMain (in LaunchServices) + 192 [0x7fff91e71067]

+ 2652 CFRunLoopRun (in CoreFoundation) + 97 [0x7fff8a555961]

+ 2652 CFRunLoopRunSpecific (in CoreFoundation) + 296 [0x7fff8a513fc8]

+ 2652 __CFRunLoopRun (in CoreFoundation) + 1356 [0x7fff8a51477c]

+ 2652 __CFRunLoopServiceMachPort (in CoreFoundation) + 212 [0x7fff8a5152b4]

+ 2652 mach_msg (in libsystem_kernel.dylib) + 55 [0x7fff993cb0d7]

+ 2652 mach_msg_trap (in libsystem_kernel.dylib) + 10 [0x7fff993cbc96]

2652 Thread_869911 DispatchQueue_2: com.apple.libdispatch-manager (serial)

+ 2652 _dispatch_mgr_thread (in libdispatch.dylib) + 52 [0x7fff8ba05d85]

+ 2652 _dispatch_mgr_invoke (in libdispatch.dylib) + 216 [0x7fff8ba0611d]

+ 2652 kevent_qos (in libsystem_kernel.dylib) + 10 [0x7fff993d20a2]

2652 Thread_1121716 DispatchQueue_20: com.apple.lsd.registrationIO (serial)

2652 start_wqthread (in libsystem_pthread.dylib) + 13 [0x7fff9ace5375]

2652 _pthread_wqthread (in libsystem_pthread.dylib) + 1129 [0x7fff9ace74f2]

2652 _dispatch_worker_thread3 (in libdispatch.dylib) + 91 [0x7fff8ba03ab8]

2652 _dispatch_root_queue_drain (in libdispatch.dylib) + 538 [0x7fff8ba03d0b]

2652 _dispatch_queue_invoke (in libdispatch.dylib) + 549 [0x7fff8ba0b6bf]

2652 _dispatch_queue_drain (in libdispatch.dylib) + 754 [0x7fff8ba04ff3]

2652 _dispatch_client_callout (in libdispatch.dylib) + 8 [0x7fff8ba003c3]

2652 _dispatch_call_block_and_release (in libdispatch.dylib) + 12 [0x7fff8ba0b8f5]

2652 -[LSServerDelegate dispatchMessage:withConnection:] (in LaunchServices) + 281 [0x7fff91e6fc0b]

2652 -[LSDXPCServer registerItemInfo:withConnection:Action:] (in LaunchServices) + 1327 [0x7fff91e73c0a]

2652 _LSCreateRegistrationData (in LaunchServices) + 2307 [0x7fff91eded2b]

2652 _LSAddEntitlementsToDictionary(__CFURL const*, __CFDictionary*) (in LaunchServices) + 111 [0x7fff91e6db91]

2652 SecStaticCodeCreateWithPath (in Security) + 238 [0x7fff945813a8]

2652 Security::CodeSigning::DiskRep::bestGuess(char const*, Security::CodeSigning::DiskRep::Context const*) (in Security) + 111 [0x7fff94584111]

2652 Security::CodeSigning::BundleDiskRep::BundleDiskRep(char const*, Security::CodeSigning::DiskRep::Context const*) (in Security) + 222 [0x7fff9457a28c]

2652 Security::CodeSigning::BundleDiskRep::setup(Security::CodeSigning::DiskRep::Con text const*) (in Security) + 1036 [0x7fff9457a73e]

2652 Security::CodeSigning::DiskRep::bestFileGuess(char const*, Security::CodeSigning::DiskRep::Context const*) (in Security) + 130 [0x7fff9458437e]

2652 Security::CodeSigning::DiskRep::bestGuess(char const*, Security::CodeSigning::DiskRep::Context const*) (in Security) + 317 [0x7fff945841df]

2652 Security::CodeSigning::MachORep::MachORep(char const*, Security::CodeSigning::DiskRep::Context const*) (in Security) + 390 [0x7fff945923a6]

2614 Security::Universal::Universal(Security::UnixPlusPlus::FileDesc, unsigned long, unsigned long) (in Security) + 787 [0x7fff94669431]

! 2585 Security::UnixPlusPlus::FileDesc::read(void*, unsigned long, unsigned long) (in Security) + 11 [0x7fff9466a6f7]

! : 2585 pread (in libsystem_kernel.dylib) + 10,20 [0x7fff993d2462,0x7fff993d246c]

! 22 Security::UnixPlusPlus::FileDesc::read(void*, unsigned long, unsigned long) (in Security) + 11,15,... [0x7fff9466a6f7,0x7fff9466a6fb,...]

! 5 DYLD-STUB$$pread (in Security) + 0 [0x7fff94684f68]

! 2 pread (in libsystem_kernel.dylib) + 0 [0x7fff993d2458]

38 Security::Universal::Universal(Security::UnixPlusPlus::FileDesc, unsigned long, unsigned long) (in Security) + 790,819,... [0x7fff94669434,0x7fff94669451,...]


Many thanks for your help!

Dec 23, 2015 1:29 AM in response to fr_

I had exactly the same issue on my Macbook Air after upgrading to 10.11, though it took me ages to notice. I didn't have the issue on any of the other 3 Macs I upgraded on the same week. The issues was the "lsd" process at nearly 100% of one CPU all the time.


In the end I solved it only by re-installing the OS. I tried lots of solutions from here and other discussion boards, but none worked.


What I did was this, though I would only recommend it to those who have other computers and several full backups:

1. I allowed the root user to delete crucial system files by changing the system integrity protection setting in the recovery partition.

2. I booted into the system from a backup disk.

3. I then merrily deleted all the files connected with the "lsd" process, including vital system files. When in doubt, I deleted.

4. The system wouldn't then start up (not a surprise), so I rebooted into recovery and reinstalled the OS.


Result was that my files were all present and worked and whatever it was that was messed up was set correctly by the reinstall and now works without the "lsd" process going crazy. While drastic, in the end it probably saved time because I stopped tinkering around trying to solve the issue. YMMV.

Aug 28, 2016 1:55 PM in response to alder89

Hello all,


I have this behaviour on a fully patch 10.11.6 macosx. I will frequently have two lsd process running at over 100 % cpu :


PID   COMMAND      %CPU  TIME     #TH    #WQ  #PORT MEM    PURG   CMPR PGRP PPID STATE    BOOSTS           %CPU_ME %CPU_OTHRS UID  FAULTS   COW     MSGSENT   MSGRECV
6682  lsd          122.1 00:02.72 7/1    5/1  66+   14M+   0B     0B   6682 1    running  *2[2+]           0.33852 0.08324    0    24773+   1953+   225+      82+
6681  lsd          108.0 00:04.42 8/1    6/1  115+  16M+   0B     0B   6681 1    running  *604+[1]         0.05423 10.92521   501  28396+   3052+   8749+     2536+


For some Users, deleting the entire Library directory has removed the second lsd process, but for the admin user, it has not work, I keep getting two lsd process running and crashing all the time. It seems to bug down the machine as these take a lot of cpu, keep crashing and dump a report and restart every 5 seconds.


The crash report tells me that thread 2 is the problematic on :


Thread 2 Crashed:: Dispatch queue: com.apple.lsd.database
0   com.apple.LaunchServices            0x00007fff9950f565 _LSClaimRemove + 327
1   com.apple.LaunchServices            0x00007fff9950e1b2 _LSBundleRemove + 277
2   com.apple.LaunchServices            0x00007fff9952e4f8 _LSServerItemInfoRegistration + 1905
3   com.apple.LaunchServices            0x00007fff9952a8ea _LSDispatchRegistration(LSContext*, char const*, LSRegistrationInfo*, __CFData const*, __CFData const*, __CFData const*, __CFURL const*, __CFDictionary const*, unsigned int*, __CFArray**, unsigned char*) + 212
4   com.apple.LaunchServices            0x00007fff994b959d _LSRegisterDirectoryNode(LSContext*, FSNode*, FSNode*, LSRegistrationInfo*, __CFData const*, __CFDictionary const*, __CFArray**, unsigned char*, unsigned int*) + 86
5   com.apple.LaunchServices            0x00007fff994b92ec _LSRegisterBundleNode(LSContext*, unsigned int, FSNode*, FSNode*, unsigned int, __CFDictionary const*, __CFArray**, unsigned char*, unsigned int*) + 863
6   com.apple.LaunchServices            0x00007fff9948790d _LSFindOrRegisterBundleNode + 912
7   com.apple.LaunchServices            0x00007fff995295f0 _LSRegisterNode + 72
8   com.apple.LaunchServices            0x00007fff99518d95 _LSRegisterURLWithOptions + 61
9   com.apple.LaunchServices            0x00007fff994f0cb7 __ScanURL_block_invoke + 23
10  libdispatch.dylib                   0x00007fff8aed640b _dispatch_client_callout + 8
11  libdispatch.dylib                   0x00007fff8aed79f2 _dispatch_barrier_sync_f_invoke + 74
12  com.apple.LaunchServices            0x00007fff994f0bbe ScanURL + 134
13  com.apple.LaunchServices            0x00007fff994f0a67 ApplyScanPath + 276
14  com.apple.CoreFoundation            0x00007fff896ccd74 CFArrayApplyFunction + 68
15  com.apple.LaunchServices            0x00007fff994f06f4 -[LSDatabaseBuilder findAndRegisterApplicationBundles] + 136
16  com.apple.LaunchServices            0x00007fff994efe52 __48-[LSDatabaseBuilder createAndSeedLocalDatabase:]_block_invoke + 228
17  libdispatch.dylib                   0x00007fff8aee193d _dispatch_call_block_and_release + 12
18  libdispatch.dylib                   0x00007fff8aed640b _dispatch_client_callout + 8
19  libdispatch.dylib                   0x00007fff8aedb03b _dispatch_queue_drain + 754
20  libdispatch.dylib                   0x00007fff8aee1707 _dispatch_queue_invoke + 549
21  libdispatch.dylib                   0x00007fff8aed9d53 _dispatch_root_queue_drain + 538
22  libdispatch.dylib                   0x00007fff8aed9b00 _dispatch_worker_thread3 + 91
23  libsystem_pthread.dylib             0x00007fff9a32c4de _pthread_wqthread + 1129
24  libsystem_pthread.dylib             0x00007fff9a32a341 start_wqthread + 13


But I have now clue what to do with this. If I look at opened file using the following command :

pgrep -u `id -u` lsd | xargs lsof -r2 -p

I get the following list :


COMMAND   PID     USER   FD     TYPE DEVICE  SIZE/OFF     NODE NAME
lsd     41271 simonpie  cwd      DIR   1,12      1496        2 /
lsd     41271 simonpie  txt      REG   1,12     17728 23352880 /usr/libexec/lsd
lsd     41271 simonpie  txt      REG   1,12     50744 25509709 /private/var/folders/m_/0l9z5b7s3x374wmd3s9lst8w000109/C/mds/mdsDirectory.db
lsd     41271 simonpie  txt      REG   1,12    377264 23328865 /System/Library/Frameworks/Security.framework/Versions/A/PlugIns/csparser.bundle/Contents/MacOS/csparser
lsd     41271 simonpie  txt      REG   1,12     32768 25496793 /private/var/db/mds/messages/se_SecurityMessages
lsd     41271 simonpie  txt      REG   1,12    154460 23978910 /Library/Keychains/System.keychain
lsd     41271 simonpie  txt      REG   1,12    428344 23331106 /System/Library/Keychains/SystemRootCertificates.keychain
lsd     41271 simonpie  txt      REG   1,12  26288272 23354365 /usr/share/icu/icudt55l.dat
lsd     41271 simonpie  txt      REG   1,12   2396160 25520076 /private/var/folders/m_/0l9z5b7s3x374wmd3s9lst8w000109/0/com.apple.LaunchServices-1341033.csstore
lsd     41271 simonpie  txt      REG   1,12    643792 23352342 /usr/lib/dyld
lsd     41271 simonpie  txt      REG   1,12 560096732 25495894 /private/var/db/dyld/dyld_shared_cache_x86_64
lsd     41271 simonpie    0r     CHR    3,2       0t0      330 /dev/null
lsd     41271 simonpie    1u     CHR    3,2       0t0      330 /dev/null
lsd     41271 simonpie    2u     CHR    3,2     0t199      330 /dev/null
lsd     41271 simonpie    3u  KQUEUE                           count=2, state=0x12


Which is very stable. I have tried to delete the only DB mentionned in there, mdsDirectory.db, but to now avail. I have tried the entire /private/var/folder/m_/, again with no result.


Has anyone any advice ?

/usr/libexec/lsd using 100% of CPU

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.