Failed to create - mailbox is locked

Ken Murchison murch at
Thu Sep 3 09:50:49 EDT 2015

On 09/03/2015 08:42 AM, Bron Gondwana wrote:
> IOERROR: failed to create!user.REDACTED.#calendars (Mailbox is locked)
> We get these occasionally, and I wondered why until just now, when I remembered...
> The initial CREATE or RENAME lock.. it's a mboxname_lock EXCLUSIVE, and it's taken with nowait, and error if exists.  It needs to, because the source mailbox is locked, and you need to break a lock loop if you issued rename A => B and rename B => A in parallel.
> So it was assumed as being not a problem, because you'd never try to create the same name twice concurrently.  The name didn't exist before, so nobody will be looking at it.
> When I say "it was assumed", I mean that I assumed.  In 2009 some time.
> But that's not true when you're autocreating the same name when you try to read something.  Anything.
> In fact, the way that the parser works, you wind up doing it for any http request.  So you get a race between two processes, one loses, logs this.
> We should probably fix this :)
> Bron.

Doesn't the current code check to see if the calendar-home-set mailbox 
(and others) exist before trying to CREATE them?

Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University

More information about the Cyrus-devel mailing list