From 4e61e49143ceceb04efbba62e048c648be97cfc4 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Fri, 28 Mar 2014 14:00:39 -0700 Subject: [PATCH] CLOUDSTACK-6303 [Automation] [UI] Account creation hang in UI Changes: - Caused due to a MySql error during 'Project' account cleanup. The MySql error hits a deadlock bug in the MessageBus code that does not release the lock/decrement the counter Eventually all callers on the MessageBus end up waiting to enter - This fixes the account cleanup MySql error. --- server/src/com/cloud/user/AccountManagerImpl.java | 6 ++++-- .../org/apache/cloudstack/iam/server/IAMServiceImpl.java | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index f0d129a3cee..2070ee6b4de 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -660,8 +660,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M // delete the account from project accounts _projectAccountDao.removeAccountFromProjects(accountId); - //delete the account from group - _messageBus.publish(_name, MESSAGE_REMOVE_ACCOUNT_EVENT, PublishScope.LOCAL, accountId); + if (account.getType() != Account.ACCOUNT_TYPE_PROJECT) { + // delete the account from group + _messageBus.publish(_name, MESSAGE_REMOVE_ACCOUNT_EVENT, PublishScope.LOCAL, accountId); + } // delete all vm groups belonging to accont List groups = _vmGroupDao.listByAccountId(accountId); diff --git a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java index 097d84f958c..56c931a9d10 100644 --- a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java +++ b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java @@ -147,6 +147,9 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager { List groupIds = _aclGroupAccountMapDao.customSearch(groupSc, null); + if (groupIds == null || groupIds.isEmpty()) { + return new ArrayList(); + } SearchBuilder sb = _aclGroupDao.createSearchBuilder(); sb.and("ids", sb.entity().getId(), Op.IN); SearchCriteria sc = sb.create();