QPID-7306: Fix race conditions during Queue destruction.

Stack traces indicate a Queue was being destroyed concurrently while still in
use by its ManagedObject.

ManagedObject holds a plain pointer to the Manageable object (e.g. Queue) it
belongs to.  The Manageable calls ManagedObject::resourceDestroy() when it is
deleted, but without any locking.

Added a locked wrapper class ManageablePtr so destroy is atomic with respect to
other calls via ManageablePtr, calls after pointer is reset to 0 in destroy()
are skipped.

Call resourceDestroy() in Queue::~Queue if it was not called already. This is
probably redundant given given the fixes above but can't hurt.

Queue::destroyed() was also being called without locking and could be called
concurrrently, e.g. if auto-delete happens concurrently with delete via QMF or
by a 0-10 client. Moved the destroyed() call into QueueRegistry::destroy(),
using QueueRegistry lock to guarantee it is called exactly once.

git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1749782 13f79535-47bb-0310-9956-ffa450edef68
9 files changed
tree: 37b11722254d3109e23ebe676a1137840120a107
  1. qpid/
  2. .gitignore
  3. .mailmap
  4. .travis.yml
  5. appveyor.yml