Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid taking open handler mutex from request manager failure.
Observed deadlock: Thread 1: - FileTimer::Run holds FileTimer::pMutex - FileStateHandler::Tick wants to take the FileStateHandler::pMutex Thread 2: - FileStateHandler::OnStateError holds the FileStateHandler::pMutex lock - RequestManager::requestFailure calls - OpenHandler::current_source, which wants the OpenHandler::m_mutex Thread 3: - OpenHandler::HandleResponseWithHosts holds OpenHandler::m_mutex, - ~FileStateHandler calls FileTimer::UnRegisterFileObject which tries to get the FileTimer::pMutex. We remove the call to OpenHandler::current_source to break the deadlock. If a file-open is in progress, we cannot take the open handler mutex from within (RequestManager::requestFailure). It is safe to call XrdAdaptor::RequestManager::OpenHandler::open from within the requestFailure callback; if the file-open was in progress, it will return the shared future and not touch Xrootd code. If the file-open was not in progress, it is safe to take the open handler mutex in the first place.
- Loading branch information