23

Recently my Mac is showing up some weird messages such as "Month 13 is out of bounds".

enter image description here

How do I fix this error I can't go to ant apple authorized repair centre because it is very far away from an Apple centre

  • From @tgray: "I started getting the high CPU usage today because of UserEventAgent. It also uses a huge amount of RAM (30+ GB if I let it run long enough). Force quitting and rebooting changed nothing. I did a sample of the process and saw a ton of lines dealing with dates. When I changed the date to November my CPU usage went back to normal. The second I changed it to the present it went bonkers again. I wonder if this is related to the iOS date bug in 11.2.1? I hope Apple fixes it soon because my computer is unusable." – JMY1000 Dec 3 '17 at 7:30
10

This error is logged on iOS 11 and on macOS 10.13 for sure and I'm not seeing it cause any specific function or problem on any platform.

I'll link to the main question here about "does macOS log too much" since that's an opinion and impression that is worthy of discussion. Some people might feel better if there were no messages unless a really serious condition needs action. Others want even more detail so they can know what's happening / learn / measure. So, it's going to be a tradeoff how these are issues / categorized / used.

One interesting developer that has some tools is Howard Oakley who blogs at https://eclecticlight.co/

His downloads page has two apps of interest (use the left downloads link as the product versions below are beta and may not be current in a day or week):

  • Consolation - an alternative console browser
  • Woodpile - a tool to count / bin / analyze patterns of logging
10

I can verify the legitimacy of this problem. I had the same issue yesterday, and after a restart, the computer was rendered almost useless due to this error. For some reason, the computer can't deal with this month and throws errors wherever there are databases or plists.

To fix this:

  1. Open Activity Monitor and force quit two processes: lsd, UserEventAgent

  2. Open System Preferences and navigate to "Date & Time"

  3. Uncheck "Set date and time automatically"

  4. In the calendar, select a date prior to December 2017 and press Save

  5. If UserEventAgent or lsd continue to cause problems, then force quit them again after setting the date.

Other people here have this problem

Why?

It seems to me, UserEventAgent was attempting to use two plist files:

System/Library/LaunchAgents/com.apple.UserEventAgent-Aqua.plist

and

System/Library/LaunchAgents/com.apple.UserEventAgent-LoginWindow.plist

When it tried to use the plists, it got an error:

Month 13 is out of bounds

I'm not sure what actually happened within UserEventAgent, but it's obvious that when it gets the error, it cannot deal with it and causes high CPU and RAM usage.

  • This doesn't work for me I tried almost three times but nothing happens. – nobody user Dec 3 '17 at 5:03
  • @qwerty You still get the error despite having your date and time set before December 2017? Ideally, set Date and Time to Nov. 1, then kill the processes mentioned above with activity monitor. – Ckacmaster Dec 3 '17 at 5:29
  • I even tried that before. I also tried changing it to January 1 but it still doesn't work I think I should just ignore this error because I don't have high CPU usage or RAM usage. I hope apple fixes this in the next software update. Well at least this is better than the root bug:macrumors.com/how-to/temporarily-fix-macos-high-sierra-root-bug – nobody user Dec 3 '17 at 5:43
  • (I can’t add a comment, sorry.) I started getting the high CPU usage today because of UserEventAgent. It also uses a huge amount of RAM (30+ GB if I let it run long enough). Force quitting and rebooting changed nothing. I did a sample of the process and saw a ton of lines dealing with dates. When I changed the date to November my CPU usage went back to normal. The second I changed it to the present it went bonkers again. I wonder if this is related to the iOS date bug in 11.2.1? I hope Apple fixes it soon because my computer is unusable. – hmode Dec 3 '17 at 5:55
  • 1
    @qwerty Don't let your computer shut off at all until Apple patches this. I made the mistake of restarting when I first saw the error in my XCode console, and my RAM and CPU usage took a turn for the worse.. After some investigation I figured I'd do the above for a temporary solution, as my computer was almost useless. The error is mostly harmless unless you restart or try to load any plist files. – Ckacmaster Dec 3 '17 at 6:05
2

I had the same issue with extremely high UserEventAgent CPU and memory usage starting at the beginning of December 2017. Console showed the "month out of bounds" error as described above.

I tried disk utility "first aid," reboots, safe mode (to clear system cache), clearing NVRAM and SMD, nothing helped. I did notice that the CPU and memory usage didn't spike in safe mode.

Like @tgray and u/kidtexas, at some point I figured out that if I disabled all my custom launchd plists that the problem didn't occur.

I eventually wrote the little script below to help me debug which plist was causing the issue. It ended up being a plist that runs on the first of every month:

<key>StartCalendarInterval</key>
<dict>
    <key>Day</key>
    <integer>1</integer>
    <key>Hour</key>
    <integer>03</integer>
    <key>Minute</key>
    <integer>00</integer>
</dict>

Many of my plists use the StartCalendarInterval key, and using the script below I could show that they didn't seem to cause the spiking RAM and memory issues, so it's not entirely clear to me why one specific plist cause the problem. Regardless, this is how I sorted it out.

I strongly recommend readers look through the script to try to understand what it does instead of just copy and paste. Specifically, as written this will only work for plists in ~/Library/LaunchAgents (not /Library/LaunchDaemons and others), and it intentionally only tests plists whose filename and <key>Label</key> follow the specific pattern: com.USERNAME.my_plist_name[.plist]. Before running it, I used a one-liner to bootout all of my plists: for plist in com."$(whoami)".*.plist; do launchctl bootout gui/"${MYUID}"/"${plist%.plist}" || true; done, and then verified they no longer appeared under launchctl list results.

#! /bin/bash
# https://apple.stackexchange.com/questions/307512/month-13-is-out-of-bounds

set -euf -o pipefail

MYUID="$(id -u)"

pushd "${HOME}"/Library/LaunchAgents

while IFS= read -r -d '' plist; do
  echo "${plist}"
  stats=($(ps ux | grep -v grep | grep UserEventAgent | awk '{ print $3, $5}'))
  cpu="${stats[0]}"
  vmem="${stats[1]}"
  echo "CPU use and virtual memory size while disabled: ${stats[@]}"
  launchctl bootstrap gui/"${MYUID}" "${plist}"
  sleep 5
  stats=($(ps ux | grep -v grep | grep UserEventAgent | awk '{ print $3, $5}'))
  echo "CPU use and virtual memory size while enabled: ${stats[@]}"
  echo "Change in vmem: $(( "${vmem}" - "${stats[1]}" ))"
  echo
done < <(find . -iname "com.$(whoami).*.plist" -print0)

popd
  • Note to people running this: it assumes that all the agents it's testing are already disabled, so take heed to run the bootout (or similar) that n8henrie recommends. – Ken Williams Dec 6 '17 at 15:48
1

Like others, I was having high CPU usage and huge RAM usage from UserEventAgent (see my comment above). Changing the date to November and force quitting UserEventAgent fixed things. This all started on Saturday after I rebooted.

Fix

I figured this out for me. Hopefully for others with issues, this will work for you.

The issue was a LaunchAgent plist I have in ~/Library/LaunchAgents. It's a simple plist file that calls StartCalendarInterval, which is a valid key for launchd plists. The LaunchAgent job calls a shell script that copies some files to a backup location on the first day of the month. The job is not being called at all - I think it is launchd checking the loaded jobs against the Calendar which is causing the issue. As soon as I unloaded this plist and moved the file out of the directory, UserEventAgent was fine (after a force quit). The second I loaded the plist (launchctl load xxxx), UserEventAgent went nuts.

StartCalendarInterval is a valid key for launchd as seen here in Apple's docs.

So for anyone having issues, check your LaunchAgent directories and looks for the StartCalendarInterval key (or any other calendar related key). I did not have any issues with the time based interval plists.

Note: This doesn't fix the 'Month 13 out of bounds' errors, just the crazy UserEventAgent behavior.

  • Actually I don't have high User Event Agent CPU usage.And I also don't have high ZCPU and RAM usage. – nobody user Dec 5 '17 at 11:08
  • This answer helped me. Though I didn't have problems with UserEventAgent but lsd went crazy. Luckily, I remember that I created plist with StartCalendarEvent by myself. Just disabled it and force-killed lsd. – Denis The Menace Dec 12 '17 at 20:23
0

After reporting this to Apple and scaling the escalation chain, I was told this should be fixed in macOS 10.13.3.

Apparently, this is caused by an application calling the Deprecated NSDate procedure ‘descriptionWithCalendarFormat’.

You can read more at https://forums.developer.apple.com/thread/88417.

In some cases, editing or removing certain plist files will prevent programs from calling the deprecated procedure, but the real fix is an OS update.

You must log in to answer this question.

protected by Community Dec 7 '17 at 0:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .