cms-sw/cmssw — pull request #6452 by bbockelm (2014-11-17 17:40:20+00:00)
Title: XrdRequestManager::OpenHandler improved object lifetime management

Object lifetime management has always been tricky with the XrdCl code. In particular,
- With OpenHandler, outstanding callbacks cannot be canceled so we have to be ready for open callbacks to return *after* the TFile is closed.
- As the TFile owns the IO buffers, any Read / ReadV handlers must be finished by time we return / throw an exception.

This PR fixes up the lifetime management to obey these rules. In particular:
- We call wait() on all futures associated with reads before we call get().
- The OpenHandler now carries a strong self-reference while the callback is alive.
- The OpenHandler also carries a weak reference to the RequestManager; if the callback is invoked when the weak reference points to an invalid object, we throw away the results and do not try to contact the parent object.
- The file close is now asynchronous (the inactive sources are, by definition, poorly performing and I've observed the close() taking more than 3 minutes).

With this PR, I now observe no crashes in XrdAdaptor code during widescale testing!