5072 Jan Wedvik 2013-01-21
This is a commit for Bug#14488185 (NDBMTD CRASH 2341 IN SIMULATEDBLOCK.CPP DUE
TO LACK OF LONGMESSAGEBUFFER MEMORY). This commit does not fix the bug, but is
intended to help pinpointing the cause of the bug. The root cause is believed
to be one or more leaks of section segments. These leaks eventually empties the
pool of section segments. The data node then crashes when it tries to allocate
segments. This commit should make the data node crash when a leak of segments
is seen. Hopefully, this will provide a stack trace and/ot trace files that
can help us to identify the actual bug.
modified:
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
storage/ndb/src/kernel/vm/VMSignal.hpp
5071 Maitrayi Sabaratnam 2013-01-18
Bug#14725833 - OPTIMZE OF TABLE CRASHES MYSQLD: add copyright year
modified:
sql/ha_ndbcluster_binlog.cc
=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.cpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2012-01-11 09:58:33 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2013-01-21 08:51:46 +0000
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -297,45 +297,34 @@ SimulatedBlock::signal_error(Uint32 gsn,
extern class SectionSegmentPool g_sectionSegmentPool;
-#define check_sections(signal, cnt, cnt2) do { if (unlikely(cnt)) { handle_invalid_sections_in_send_signal(signal); } else if (unlikely(cnt2 == 0 && (signal->header.m_fragmentInfo != 0 && signal->header.m_fragmentInfo != 3))) { handle_invalid_fragmentInfo(signal); } } while(0)
-
void
-SimulatedBlock::handle_invalid_sections_in_send_signal(Signal* signal) const
+SimulatedBlock::handle_invalid_sections_in_send_signal(const Signal* signal)
+const
{
- //Uint32 cnt = signal->header.m_noOfSections;
-#if defined VM_TRACE || defined ERROR_INSERT
+ char errMsg[160];
+ BaseString::snprintf(errMsg, sizeof errMsg,
+ "Unhandled sections in sendSignal for GSN %u (%s).",
+ signal->header.theVerId_signalNumber,
+ getSignalName(signal->header.theVerId_signalNumber));
+ // Print message and terminate.
ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO,
- "Unhandled sections in sendSignal",
- "");
-#else
- infoEvent("Unhandled sections in sendSignal!!");
-#endif
-}
-
-void
-SimulatedBlock::handle_lingering_sections_after_execute(Signal* signal) const
-{
- //Uint32 cnt = signal->header.m_noOfSections;
-#if defined VM_TRACE || defined ERROR_INSERT
- ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO,
- "Unhandled sections after execute",
- "");
-#else
- infoEvent("Unhandled sections after execute");
-#endif
+ errMsg,
+ "");
}
void
-SimulatedBlock::handle_lingering_sections_after_execute(SectionHandle* handle) const
+SimulatedBlock::handle_lingering_sections_after_execute(const Signal* signal)
+const
{
- //Uint32 cnt = signal->header.m_noOfSections;
-#if defined VM_TRACE || defined ERROR_INSERT
+ char errMsg[160];
+ BaseString::snprintf(errMsg, sizeof errMsg,
+ "Unhandled sections after execute for GSN %u (%s).",
+ signal->header.theVerId_signalNumber,
+ getSignalName(signal->header.theVerId_signalNumber));
+ // Print message and terminate.
ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO,
- "Unhandled sections(handle) after execute",
- "");
-#else
- infoEvent("Unhandled sections(handle) after execute");
-#endif
+ errMsg,
+ "");
}
void
@@ -510,18 +499,17 @@ SimulatedBlock::sendSignal(BlockReferenc
BlockReference sendBRef = reference();
- Uint32 noOfSections = signal->header.m_noOfSections;
Uint32 recBlock = refToBlock(ref);
Uint32 recNode = refToNode(ref);
Uint32 ourProcessor = globalData.ownId;
+ check_sections(signal, signal->header.m_noOfSections, 0);
+
signal->header.theLength = length;
signal->header.theVerId_signalNumber = gsn;
signal->header.theReceiversBlockNumber = recBlock;
signal->header.m_noOfSections = 0;
- check_sections(signal, noOfSections, 0);
-
Uint32 tSignalId = signal->header.theSignalId;
if ((length == 0) || length > 25 || (recBlock == 0)) {
=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2012-10-17 13:04:33 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2013-01-21 08:51:46 +0000
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -359,9 +359,8 @@ protected:
bool dupSection(Uint32& copyFirstIVal, Uint32 srcFirstIVal);
bool writeToSection(Uint32 firstSegmentIVal, Uint32 offset, const Uint32* src, Uint32 len);
- void handle_invalid_sections_in_send_signal(Signal*) const;
- void handle_lingering_sections_after_execute(Signal*) const;
- void handle_lingering_sections_after_execute(SectionHandle*) const;
+ void handle_invalid_sections_in_send_signal(const Signal*) const;
+ void handle_lingering_sections_after_execute(const Signal*) const;
void handle_invalid_fragmentInfo(Signal*) const;
void handle_send_failed(SendStatus, Signal*) const;
void handle_out_of_longsignal_memory(Signal*) const;
@@ -912,6 +911,9 @@ private:
void execUTIL_UNLOCK_REF(Signal* signal);
void execUTIL_UNLOCK_CONF(Signal* signal);
+ void check_sections(Signal* signal,
+ Uint32 oldSecCount,
+ Uint32 newSecCount) const;
protected:
void fsRefError(Signal* signal, Uint32 line, const char *msg);
@@ -1296,6 +1298,25 @@ SimulatedBlock::EXECUTE_DIRECT(Uint32 bl
#endif
}
+// Do a consictency check before reusing a signal.
+inline void
+SimulatedBlock::check_sections(Signal* signal,
+ Uint32 oldSecCount,
+ Uint32 newSecCount) const
+{
+ // Sections from previous use should have been consumed by now.
+ if (unlikely(oldSecCount != 0))
+ {
+ handle_invalid_sections_in_send_signal(signal);
+ }
+ else if (unlikely(newSecCount == 0 &&
+ signal->header.m_fragmentInfo != 0 &&
+ signal->header.m_fragmentInfo != 3))
+ {
+ handle_invalid_fragmentInfo(signal);
+ }
+}
+
/**
* Defines for backward compatiblility
*/
@@ -1320,15 +1341,6 @@ BLOCK::addRecSignal(GlobalSignalNumber g
#include "Mutex.hpp"
-inline
-SectionHandle::~SectionHandle()
-{
- if (unlikely(m_cnt))
- {
- m_block->handle_lingering_sections_after_execute(this);
- }
-}
-
#ifdef ERROR_INSERT
#define RSS_AP_SNAPSHOT(x) Uint32 rss_##x
#define RSS_AP_SNAPSHOT_SAVE(x) rss_##x = x.getNoOfFree()
=== modified file 'storage/ndb/src/kernel/vm/VMSignal.hpp'
--- a/storage/ndb/src/kernel/vm/VMSignal.hpp 2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/vm/VMSignal.hpp 2013-01-21 08:51:46 +0000
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -293,4 +293,15 @@ SectionHandle::getSection(SegmentedSecti
return false;
}
+inline
+SectionHandle::~SectionHandle()
+{
+ if (unlikely(m_cnt))
+ {
+ ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO,
+ "Unhandled sections(handle) after execute",
+ "");
+ }
+}
+
#endif
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (jan.wedvik:5071 to 5072)Bug#14488185 | Jan Wedvik | 21 Feb 2013 |