Announcement: Upgrade to macOS Mojave

With features like Dark Mode, Stacks, and four new built-in apps, macOS Mojave helps you get more out of every click. 
Find out how to upgrade to macOS Mojave > https://support.apple.com/macos/mojave

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

Question:

Question: com.apple.xpc.launchd & com.apple.mdworker.bundles pollute logs with errors

I made a clean install of Yosemite to MacBook Pro (13-inch, Early 2011), and restored documents and apps from TM backup, no problems so far, but I observe following repeating messages in system log and it concerns me, because apparently, launchd is trying to do something related to spotlight, but fails and this happens every 10 seconds.. I see no suspicious activity apart from too much CPU time spent on mds and mds_stores (but I guess it's due to fresh install, hence Spotlight needs to index everything...).


Any ideas where to dig?


21/10/2557 BE 2:11:43.811 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[2654]) Could not find uid associated with service: 0: Undefined error: 0 502

21/10/2557 BE 2:11:43.835 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

21/10/2557 BE 2:11:53.838 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[2655]) Could not find uid associated with service: 0: Undefined error: 0 502

21/10/2557 BE 2:11:53.838 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

[goes forever]

Posted on

Reply
Question marked as Solved
Answer:
Answer:

I see, Dustmoo.. I thought the issue was caused by having that account with UID 502 in my main partition. So I dug it a bit more using your example. I actually couldn't find any mdworkers directory in /var. So I looked for the files owned by UID 502 (but it could be any other UID. One must check the last number in the error message, the one I underlined in my first post and use it instead of 502 in the following code):


cd /var

sudo find . -user 502 -exec ls -ld {} \;


This has been the output:


drwx------ 5 michele _spotlight 170 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/0

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/C

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/T


(michele is my username for UID 502)


So it was still in the /var/folder directory, but something related to or created by Spotlight one week ago. Not sure how it went there, since this was a fresh installation in that partition. It really looks like junk to me.


Just in case I removed the incriminated directory:


cd /private/var/folders/zz/

# I did some directory listing and other things just to check

sudo rm -r zyxvpxvq6csfxvn_n0000000000000

And rebooted. I can't really say if it changed anything because I had already made the new account, but it does look like the culprit.

Posted on

Question marked as Helpful

Oct 27, 2014 6:38 AM in response to Cyril Kay In response to Cyril Kay

Yeah! I've found out what it is. I had the same identical annoying message spamming:


Oct 27 13:52:53 FlatMoon com.apple.xpc.launchd[1] (com.apple.mdworker.bundles): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

Oct 27 13:53:03 FlatMoon com.apple.xpc.launchd[1] (com.apple.mdworker.bundles[1141]): Could not find uid associated with service: 0: Undefined error: 0 502


Just look at the last number; 502. It is the UID of another user. Which is present in my main partition (I have Lion and Yosemite installed in two partitions because it is an unsupported MacBook2,1. Sorry Apple, it works!! 😝).


So I just created a new user in my Yosemite partition (I may actually need it), which automatically gets UID 502 and the awful spamming disappeared! If you don't have such user you may need to change the ownership of some incriminating files in Terminal with the command:


chown <your username> <file>


you may use the recursive option like in


chown -R <your username > /Users/<your username>


I hope this helps. ^_^

Question marked as Helpful

Oct 27, 2014 11:37 AM in response to Dustmoo In response to Dustmoo

Alright, I seem to have solved it without having to create a new user, (but thanks to @Michelasso for the tip!).


I started doing some investigation and found that there were some temp files for mdworker that were in a user 502 folder:


cd /private/var/folders

sudo find . | grep mdworkers


The above command will show you which temp directories have your com.apple.mdworker.bundle file. Mine looked something like this:


./6k/p4bx5l_x0154yj65gvnsl4jw0000gn/T/com.apple.mdworker.bundle

./y8/zdsf987dsf987sdfsd_s977cd_6kg97gs/C/com.apple.mdworker.bundle

./zz/zyxvpxvq6csfxvn_n00000b400002s/C/com.apple.mdworker.bundle


I then changed my directory into each folder and did and ls -l and found that in one the whole temp folder belonged to user 502


cd y8

ls -l


drwxr-xr-x 6 502 staff 204 July 27 11:04 zdsf987dsf987sdfsd_s977cd_6kg97gs


I also noted it was old.


So I removed that whole cache:


cd /private/var/folders

sudo rm -rf y8


I then had to restart (because my mac was locked in the respawn loop) and I have put her to sleep and woken her and so far all seems well.


For some reason launchd appears to be trying to spawn from old cache data.


Anyway, please test it out and see if it solves your problem.


Cheers!


Edit: clarification.

There’s more to the conversation

Read all replies

Page content loaded

Oct 24, 2014 8:44 PM in response to Cyril Kay In response to Cyril Kay

I am having this trouble too, it seems to be related to a decrease in performance with Yosemite as well, the process is trying to respawn multiple times a second.


I am troubleshooting this, as it happened in the beta as well. It seemed that rebuilding permissions and restarting helped last time. I'll let you know if I figure it out.

Oct 24, 2014 8:44 PM

Reply Helpful

Oct 24, 2014 9:09 PM in response to Dustmoo In response to Dustmoo

After using Disk Utility to rebuild permissions, I restarted. I had to force quit my Macbook Pro (By holding the power button to force the shutdown) after it seemed get stuck shutting down.


After restarting, I canceled the dialog asking me if I wanted to reopen my applications because my computer shutdown because of a problem. And now all seems to be well. No more mdworker message in the logs and mdworker seems to be running (and apparently indexing the drive).


TL;DR I would recommend that you follow this procedure, it helped me:


  1. Use Disk Utility to rebuild your disk permissions.
  2. Save your work and quit your apps.
  3. Restart your Mac. (Force quit if you are still waiting after a couple of minutes)
  4. If after the restart Yosemite asks you if you want to reopen your Applications, "Cancel" to prevent your apps from reloading.
  5. All should be running normally.

Oct 24, 2014 9:09 PM

Reply Helpful

Oct 25, 2014 2:31 AM in response to Dustmoo In response to Dustmoo

Interesting idea, thanks for your input!

It did not work for me however. Disk Utility repaired permissions mostly in /printers/.. folders (which I never use anyway), and after quitting all apps and reboot, system log was clear for a while, but once mdworker came back to life, same mess started again.. At least in my case it's every 10 seconds, not as bad as several times a second.

Oct 25, 2014 2:31 AM

Reply Helpful

Oct 26, 2014 7:53 PM in response to wsrphoto In response to wsrphoto

I never had Smartreporter installed, so it's unrelated in my case. Log messages start 5-10 mins after reboot, maybe some other app in my case induces them, but there is nothing special really on this Macbook, apart from Chrome and VLC.

Oct 26, 2014 7:53 PM

Reply Helpful

Oct 27, 2014 5:59 AM in response to Cyril Kay In response to Cyril Kay

It started for me yesterday without using SmartReporter, which appears only to trigger it than cause it. Is there a command or something to disable this or turn the messages off, or better yet, a solution to what's causing these messages?

Oct 27, 2014 5:59 AM

Reply Helpful
Question marked as Helpful

Oct 27, 2014 6:38 AM in response to Cyril Kay In response to Cyril Kay

Yeah! I've found out what it is. I had the same identical annoying message spamming:


Oct 27 13:52:53 FlatMoon com.apple.xpc.launchd[1] (com.apple.mdworker.bundles): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

Oct 27 13:53:03 FlatMoon com.apple.xpc.launchd[1] (com.apple.mdworker.bundles[1141]): Could not find uid associated with service: 0: Undefined error: 0 502


Just look at the last number; 502. It is the UID of another user. Which is present in my main partition (I have Lion and Yosemite installed in two partitions because it is an unsupported MacBook2,1. Sorry Apple, it works!! 😝).


So I just created a new user in my Yosemite partition (I may actually need it), which automatically gets UID 502 and the awful spamming disappeared! If you don't have such user you may need to change the ownership of some incriminating files in Terminal with the command:


chown <your username> <file>


you may use the recursive option like in


chown -R <your username > /Users/<your username>


I hope this helps. ^_^

Oct 27, 2014 6:38 AM

Reply Helpful (1)

Oct 27, 2014 10:25 AM in response to Michelasso In response to Michelasso

Great, I meant to come back here and say that the solution above didn't keep. For me, it always happens when my machine is waking up. I am trying to figure out what is asking it to run for user 502 so that I can fix it without creating another user. 😀


But that is great feedback. I'll see if I can figure it out, for me a restart fixes the problem until my machine goes to sleep, upon waking the error starts.

Oct 27, 2014 10:25 AM

Reply Helpful
Question marked as Helpful

Oct 27, 2014 11:37 AM in response to Dustmoo In response to Dustmoo

Alright, I seem to have solved it without having to create a new user, (but thanks to @Michelasso for the tip!).


I started doing some investigation and found that there were some temp files for mdworker that were in a user 502 folder:


cd /private/var/folders

sudo find . | grep mdworkers


The above command will show you which temp directories have your com.apple.mdworker.bundle file. Mine looked something like this:


./6k/p4bx5l_x0154yj65gvnsl4jw0000gn/T/com.apple.mdworker.bundle

./y8/zdsf987dsf987sdfsd_s977cd_6kg97gs/C/com.apple.mdworker.bundle

./zz/zyxvpxvq6csfxvn_n00000b400002s/C/com.apple.mdworker.bundle


I then changed my directory into each folder and did and ls -l and found that in one the whole temp folder belonged to user 502


cd y8

ls -l


drwxr-xr-x 6 502 staff 204 July 27 11:04 zdsf987dsf987sdfsd_s977cd_6kg97gs


I also noted it was old.


So I removed that whole cache:


cd /private/var/folders

sudo rm -rf y8


I then had to restart (because my mac was locked in the respawn loop) and I have put her to sleep and woken her and so far all seems well.


For some reason launchd appears to be trying to spawn from old cache data.


Anyway, please test it out and see if it solves your problem.


Cheers!


Edit: clarification.

Oct 27, 2014 11:37 AM

Reply Helpful (1)
Question marked as Solved

Oct 27, 2014 3:58 PM in response to Cyril Kay In response to Cyril Kay

I see, Dustmoo.. I thought the issue was caused by having that account with UID 502 in my main partition. So I dug it a bit more using your example. I actually couldn't find any mdworkers directory in /var. So I looked for the files owned by UID 502 (but it could be any other UID. One must check the last number in the error message, the one I underlined in my first post and use it instead of 502 in the following code):


cd /var

sudo find . -user 502 -exec ls -ld {} \;


This has been the output:


drwx------ 5 michele _spotlight 170 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/0

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/C

drwx------ 2 michele _spotlight 68 Oct 16 19:10 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/T


(michele is my username for UID 502)


So it was still in the /var/folder directory, but something related to or created by Spotlight one week ago. Not sure how it went there, since this was a fresh installation in that partition. It really looks like junk to me.


Just in case I removed the incriminated directory:


cd /private/var/folders/zz/

# I did some directory listing and other things just to check

sudo rm -r zyxvpxvq6csfxvn_n0000000000000

And rebooted. I can't really say if it changed anything because I had already made the new account, but it does look like the culprit.

Oct 27, 2014 3:58 PM

Reply Helpful (1)

Oct 27, 2014 6:39 PM in response to Michelasso In response to Michelasso

Intersting, I had the numbers 504 and 1104188992./


Followed your suggestion for 504. Reboot safe boot, then normal.


Got the following errors

Oct 27 21:24:55 [name deleted]-2.local mdworker[582]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:24:55 [name deleted]-.local mdworker[581]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:25:46 [name deleted]-.local mdworker[866]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:25:46 [name deleted]-.local mdworker[867]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:27:12 [name deleted]-.local mdworker[885]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:27:12 [name deleted]-.local mdworker[884]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:30:32 [name deleted]-.local mdworker[1094]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"

Oct 27 21:30:32 [name deleted]-.local mdworker[1095]: code validation failed in the process of getting signing information: Error Domain=NSOSStatusErrorDomain Code=-67062 "The operation couldn’t be completed. (OSStatus error -67062.)"


Then no more. Hopefully gone.

Oct 27, 2014 6:39 PM

Reply Helpful

Oct 27, 2014 8:30 PM in response to Michelasso In response to Michelasso

Great job, everybody,

Finding orphaned dirs belonged to user 502 in /var/ and deleting them helped to resolve the issue (after reboot)!


Queens-MBP-3:var queen$ sudo find . -user 502 -exec ls -ld {} \;

drwx------@ 3 502 wheel 102 Nov 12 2012 ./db/launchd.db/com.apple.launchd.peruser.502

-rw------- 1 502 wheel 461 Apr 10 2013 ./db/launchd.db/com.apple.launchd.peruser.502/overrides.plist

drwx------ 5 502 _spotlight 170 Oct 19 19:23 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502

drwx------ 2 502 _spotlight 68 Oct 19 19:23 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/0

drwx------ 2 502 _spotlight 68 Oct 19 19:23 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/C

drwx------ 2 502 _spotlight 68 Oct 19 19:23 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/502/T

-r--r--r-- 1 502 _uucp 11 Dec 2 2012 ./lock/LK.055.018.010

drwx------@ 2 502 wheel 68 Apr 13 2014 ./log/com.apple.launchd.peruser.502

-rw-------@ 1 502 mail 84736 Apr 9 2013 ./mail/user


After inspecting folders, I just sudo rm -rf them and all done.


So basically, Time Machine backed up dirs that belonged to all users on previous setup, and even though I explicitly asked TM not to restore user 502's account to this fresh Yosemite install, TM still restored some of 502's folders and Spotlight was stumbling over them (because user 502 did not exist anymore).


Hopefully, Apple techs pay attention to this issue.

Oct 27, 2014 8:30 PM

Reply Helpful (1)

Oct 29, 2014 10:45 AM in response to William Paplham In response to William Paplham

William, you wrote that you had the issue with UID 1104188992 as well? Did you check for it? I meant, that looks like all but an usual UID. I believe something else is cooking under the hood. Like some pieces of old applications left running.


I'd suggest to search for files own buy both UIDs. Then if you still have the issue you may try downloading "etreCheck" (just google it) and do a scan. It reports a few things that may be wrong in the installation.

Oct 29, 2014 10:45 AM

Reply Helpful
User profile for user: Cyril Kay

Question: com.apple.xpc.launchd & com.apple.mdworker.bundles pollute logs with errors