From 976deafba68897f6b5610f663e7ef8035f26a51f Mon Sep 17 00:00:00 2001
From: unknown <tomas@poseidon.ndb.mysql.com>
Date: Tue, 16 May 2006 11:47:33 +0200
Subject: [PATCH] Bug #18591 Repeated "show" and "all status" calls to ndb_mgm
 causes mgmd to crash - not having lock can cause "block number list" to
 become corrupt => crash - also may result in 2 threads receiving same block
 no => possble cause of Bug #13987 Cluster: Loss of data nodes can cause high
 CPU usage from ndb_mgmd

ndb/src/mgmsrv/MgmtSrvr.cpp:
  ndb: added missing lock of mutex
---
 ndb/src/mgmsrv/MgmtSrvr.cpp     | 1 +
 ndb/src/ndbapi/SignalSender.cpp | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 47d156c1f9..c9e8535b75 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -2107,6 +2107,7 @@ int
 MgmtSrvr::abortBackup(Uint32 backupId)
 {
   SignalSender ss(theFacade);
+  ss.lock(); // lock will be released on exit
 
   bool next;
   NodeId nodeId = 0;
diff --git a/ndb/src/ndbapi/SignalSender.cpp b/ndb/src/ndbapi/SignalSender.cpp
index a29fe68937..0ecc98f5f2 100644
--- a/ndb/src/ndbapi/SignalSender.cpp
+++ b/ndb/src/ndbapi/SignalSender.cpp
@@ -75,7 +75,9 @@ SignalSender::SignalSender(TransporterFacade *facade)
 {
   m_cond = NdbCondition_Create();
   theFacade = facade;
+  lock();
   m_blockNo = theFacade->open(this, execSignal, execNodeStatus);
+  unlock();
   assert(m_blockNo > 0);
 }
 
-- 
2.30.9