Jamie Curmi

Q: Calendar hang for one user

Hi!

 

I have OS Server 4.1 running successfully, with 20 odd clients with Calendar Server running without problems.  However, one user (me as it happens) has what must be a corrupt (in some way) calendar.  If I try to connect, or use the WebCal, It hangs (in WebCal it just sits there spinning loading events, on Calendar it just says it can't connect after a timeout).  In the logs I can see many lines of:

 

2015-07-03 22:45:48+1000 [-] [caldav-3]  [-] [txdav.common.datastore.sql#error] Transaction abort too long: PG-TXN<<PROPFIND /calendars/__uids__/556D3E30-6FF9-4681-9985-78F192BD591A/ (1, 1)>>, Statements: 12, IUDs: 0, Statement: None

 

Now, I don’t know how or why this has suddenly happened, but I’m quite happy to wipe that calendar completely and re-import the backup I have.  I just don’t know how to wipe it without killing the 20 odd working ones (and having the entire company get angry).

 

I can’t connect at all with Calendar, as it sits there and eventually times out.  So I can’t get in and delete calendar events.

 

As I said, everyone else is fine.  Just my calendar.

 

Does anyone know of any way to wipe a calendar for just one user, but not hurt any others?

 

Any help appreciated.

Mac Pro, OS X Yosemite (10.10.3)

Posted on Jul 4, 2015 10:26 PM

Close

Q: Calendar hang for one user

  • All replies
  • Helpful answers

  • by Linc Davis,

    Linc Davis Linc Davis Jul 5, 2015 9:32 AM in response to Jamie Curmi
    Level 10 (207,963 points)
    Applications
    Jul 5, 2015 9:32 AM in response to Jamie Curmi
  • by Jamie Curmi,

    Jamie Curmi Jamie Curmi Jul 5, 2015 4:22 PM in response to Linc Davis
    Level 2 (229 points)
    Jul 5, 2015 4:22 PM in response to Linc Davis

    Thanks, but unfortunately this doesn't help.

     

    Calendar won't connect to the user's calendar. You get nothing, for a while, no calendar to export or delete...it just sits there, and eventually times out. So you can't create a new calendar, you can't export the old, you can't access the calendar to start cleaning out.

  • by Linc Davis,

    Linc Davis Linc Davis Jul 5, 2015 6:34 PM in response to Jamie Curmi
    Level 10 (207,963 points)
    Applications
    Jul 5, 2015 6:34 PM in response to Jamie Curmi

    If you have backups of the calendars, move aside or delete the folder ~/Library/Calendars on the client. Relaunch the app and try again.

  • by Jamie Curmi,

    Jamie Curmi Jamie Curmi Jul 5, 2015 7:00 PM in response to Linc Davis
    Level 2 (229 points)
    Jul 5, 2015 7:00 PM in response to Linc Davis

    Thanks Linc.  No, that doesn't work either.  Can try and connect to the calendar from a completely new machine, and it still hangs and times out.  Unfortunately.

     

    I think it needs some way to clear the calendar from the server. It might require a command-line operation. I think in Server 4 they now store calendars in a database, rather than filesystem, so I can't just go and delete files by the looks of it. I'm hoping someone on the Calendar Server team might have more idea and can help?

     

    Appreciate all the ideas to try though Linc.

  • by Linc Davis,

    Linc Davis Linc Davis Jul 5, 2015 8:01 PM in response to Jamie Curmi
    Level 10 (207,963 points)
    Applications
    Jul 5, 2015 8:01 PM in response to Jamie Curmi

    You would have to export the calendars of all other users as ICS, then wipe the server data and reimport everything.

  • by Jamie Curmi,

    Jamie Curmi Jamie Curmi Jul 5, 2015 8:04 PM in response to Linc Davis
    Level 2 (229 points)
    Jul 5, 2015 8:04 PM in response to Linc Davis

    Well, I'm hoping there is some other option. To do this will probably cause upper management to tell me to scrap OS X server and get Exchange. Also, I have no reason for how this happened, so what if it happens again?

  • by Linc Davis,

    Linc Davis Linc Davis Jul 5, 2015 8:08 PM in response to Jamie Curmi
    Level 10 (207,963 points)
    Applications
    Jul 5, 2015 8:08 PM in response to Jamie Curmi

    Contact Apple Enterprise Support.

  • by Jamie Curmi,Solvedanswer

    Jamie Curmi Jamie Curmi Jul 10, 2015 1:10 AM in response to Jamie Curmi
    Level 2 (229 points)
    Jul 10, 2015 1:10 AM in response to Jamie Curmi

    Ok, one of the Software Engineers at Apple sent me the solution (I don't know if he wants me to put his name here, so I won't).  Anyway, he told me to basically do:

    You can nuke a user and all that user's calendars and events using the calendarserver_purge_principals tool.

     

    Something like this:

     

    sudo calendarserver_purge_principals -v user01

     

    Keep in mind that calendar data often belongs to more than one user. For example, running the above commands will delete not only user01's calendars, but also any events that user01 has created which others may be attending. Other attendees will see cancellation notices for those events.

     

    Now, we wanted to avoid the notification spams, so we came up with a much hackier solution, that ends up doing what was suggested, after some manual cleanup, to avoid the notifications going out.

     

    What we discovered is that we were able to delete the events directly from the calendar database, which DID NOT send any cancellation notices to anybody, but didn’t seem to completely clean up the calendars either. However, we then discovered that running the ‘purge’ command after manually deleting the events finished the clean up, and did not trigger any cancellation notices either!

     

    So the steps to fix it were:

     

    1. Get the list of users and their UUIDs to find the one you want to delete:

     

      sudo calendarserver_manage_principals --list-principals users

     

    2. Connect to the calendar server database (as root):

     

      psql -h /var/run/caldavd/PostgresSocket -U caldav caldav

     

    3. Run this query, substituting the UUID:

     

    DELETE FROM calendar_object

    WHERE calendar_object.calendar_resource_id IN (

      SELECT calendar_bind.calendar_resource_id

      FROM

      calendar_bind

      JOIN calendar_home ON calendar_home.resource_id = calendar_bind.calendar_home_resource_id

      WHERE calendar_home.owner_uid = '556D3E30-6FF9-4681-9985-78F192BD591A'

    );

     

    4. Run the purge command, substituting the UUID:

     

      sudo calendarserver_purge_principals -v 556D3E30-6FF9-4681-9985-78F192BD591A

     

    This leaves you without a calendar, so you have to then create a new one, or get someone to invite you to an event, so the system creates one for you.

     

    And hopefully this comes in handy for someone looking for a solution for a similar problem.