summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-10-11 15:48:07 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2005-10-11 15:48:07 +0200
commitf2aa4bcd15c5bad12c90ba0b34454ec274d20722 (patch)
tree93fa8a7316fe1db6a15f773b20cb8f38db1e1f67 /ndb
parentf6943edbb6afb990d36de96f3989ae272727914f (diff)
downloadmariadb-git-f2aa4bcd15c5bad12c90ba0b34454ec274d20722.tar.gz
Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission
ndb/include/mgmapi/ndbd_exit_codes.h: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added new exit code for connection setup failure ndb/include/transporter/TransporterCallback.hpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - corrected transporter callback error codes to have consistant usage of 0x8000 flag for flagging call to do disconnect ndb/src/common/transporter/SHM_Transporter.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added error info to errors ndb/src/common/transporter/SHM_Transporter.unix.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added more error info to errors ndb/src/common/transporter/Transporter.hpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added more info to report error ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added error reporting on connect failure ndb/src/kernel/error/ndbd_exit_codes.c: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - new exit code ndb/src/kernel/vm/FastScheduler.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - corrected stack overflow issues ndb/src/kernel/vm/TransporterCallback.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added error info - corrected stak overflow issues ndb/src/kernel/vm/VMSignal.hpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - added struct to allocate smaller Signal ndb/src/mgmsrv/ConfigInfo.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - enable usage of SHM default section ndb/src/ndbapi/TransporterFacade.cpp: Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission - minor syntax changes
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/mgmapi/ndbd_exit_codes.h1
-rw-r--r--ndb/include/transporter/TransporterCallback.hpp72
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.cpp22
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.hpp2
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.unix.cpp28
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.win32.cpp6
-rw-r--r--ndb/src/common/transporter/Transporter.hpp3
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp4
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp10
-rw-r--r--ndb/src/kernel/error/ndbd_exit_codes.c1
-rw-r--r--ndb/src/kernel/vm/FastScheduler.cpp15
-rw-r--r--ndb/src/kernel/vm/TransporterCallback.cpp90
-rw-r--r--ndb/src/kernel/vm/VMSignal.hpp10
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp5
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp13
15 files changed, 206 insertions, 76 deletions
diff --git a/ndb/include/mgmapi/ndbd_exit_codes.h b/ndb/include/mgmapi/ndbd_exit_codes.h
index 794329ce637..4cb3fa7cde3 100644
--- a/ndb/include/mgmapi/ndbd_exit_codes.h
+++ b/ndb/include/mgmapi/ndbd_exit_codes.h
@@ -100,6 +100,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_SIGNAL_LOST 6051
#define NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL 6052
#define NDBD_EXIT_ILLEGAL_SIGNAL 6053
+#define NDBD_EXIT_CONNECTION_SETUP_FAILED 6054
/* NDBCNTR 6100-> */
#define NDBD_EXIT_RESTART_TIMEOUT 6100
diff --git a/ndb/include/transporter/TransporterCallback.hpp b/ndb/include/transporter/TransporterCallback.hpp
index f2432edd394..ef9be8c5a69 100644
--- a/ndb/include/transporter/TransporterCallback.hpp
+++ b/ndb/include/transporter/TransporterCallback.hpp
@@ -81,7 +81,9 @@ reportConnect(void * callbackObj, NodeId nodeId);
void
reportDisconnect(void * callbackObj,
NodeId nodeId, Uint32 errNo);
-
+
+#define TE_DO_DISCONNECT 0x8000
+
enum TransporterError {
TE_NO_ERROR = 0,
/**
@@ -111,7 +113,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisconnect)
*/
- TE_INVALID_MESSAGE_LENGTH = 0x8003,
+ TE_INVALID_MESSAGE_LENGTH = 0x3 | TE_DO_DISCONNECT,
/**
* TE_INVALID_CHECKSUM
@@ -120,7 +122,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- TE_INVALID_CHECKSUM = 0x8004,
+ TE_INVALID_CHECKSUM = 0x4 | TE_DO_DISCONNECT,
/**
* TE_COULD_NOT_CREATE_SOCKET
@@ -129,7 +131,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- TE_COULD_NOT_CREATE_SOCKET = 0x8005,
+ TE_COULD_NOT_CREATE_SOCKET = 0x5,
/**
* TE_COULD_NOT_BIND_SOCKET
@@ -138,7 +140,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- TE_COULD_NOT_BIND_SOCKET = 0x8006,
+ TE_COULD_NOT_BIND_SOCKET = 0x6,
/**
* TE_LISTEN_FAILED
@@ -147,7 +149,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- TE_LISTEN_FAILED = 0x8007,
+ TE_LISTEN_FAILED = 0x7,
/**
* TE_ACCEPT_RETURN_ERROR
@@ -158,7 +160,7 @@ enum TransporterError {
* Recommended behavior: Ignore
* (or possible do setPerformState(PerformDisconnect)
*/
- TE_ACCEPT_RETURN_ERROR = 0x8008
+ TE_ACCEPT_RETURN_ERROR = 0x8
/**
* TE_SHM_DISCONNECT
@@ -167,7 +169,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SHM_DISCONNECT = 0x800b
+ ,TE_SHM_DISCONNECT = 0xb | TE_DO_DISCONNECT
/**
* TE_SHM_IPC_STAT
@@ -178,7 +180,12 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SHM_IPC_STAT = 0x800c
+ ,TE_SHM_IPC_STAT = 0xc | TE_DO_DISCONNECT
+
+ /**
+ * Permanent error
+ */
+ ,TE_SHM_IPC_PERMANENT = 0x21
/**
* TE_SHM_UNABLE_TO_CREATE_SEGMENT
@@ -188,7 +195,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0x800d
+ ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0xd
/**
* TE_SHM_UNABLE_TO_ATTACH_SEGMENT
@@ -198,7 +205,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0x800e
+ ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0xe
/**
* TE_SHM_UNABLE_TO_REMOVE_SEGMENT
@@ -208,12 +215,12 @@ enum TransporterError {
* Recommended behavior: Ignore (not much to do)
* Print warning to logfile
*/
- ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0x800f
+ ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0xf
- ,TE_TOO_SMALL_SIGID = 0x0010
- ,TE_TOO_LARGE_SIGID = 0x0011
- ,TE_WAIT_STACK_FULL = 0x8012
- ,TE_RECEIVE_BUFFER_FULL = 0x8013
+ ,TE_TOO_SMALL_SIGID = 0x10
+ ,TE_TOO_LARGE_SIGID = 0x11
+ ,TE_WAIT_STACK_FULL = 0x12 | TE_DO_DISCONNECT
+ ,TE_RECEIVE_BUFFER_FULL = 0x13 | TE_DO_DISCONNECT
/**
* TE_SIGNAL_LOST_SEND_BUFFER_FULL
@@ -222,7 +229,7 @@ enum TransporterError {
* a signal is dropped!! very bad very bad
*
*/
- ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x8014
+ ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x14 | TE_DO_DISCONNECT
/**
* TE_SIGNAL_LOST
@@ -231,14 +238,14 @@ enum TransporterError {
* a signal is dropped!! very bad very bad
*
*/
- ,TE_SIGNAL_LOST = 0x8015
+ ,TE_SIGNAL_LOST = 0x15
/**
* TE_SEND_BUFFER_FULL
*
* The send buffer was full, but sleeping for a while solved it
*/
- ,TE_SEND_BUFFER_FULL = 0x0016
+ ,TE_SEND_BUFFER_FULL = 0x16
/**
* TE_SCI_UNABLE_TO_CLOSE_CHANNEL
@@ -246,7 +253,7 @@ enum TransporterError {
* Unable to close the sci channel and the resources allocated by
* the sisci api.
*/
- ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x8016
+ ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x22
/**
* TE_SCI_LINK_ERROR
@@ -255,7 +262,7 @@ enum TransporterError {
* No point in continuing. Must check the connections.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_LINK_ERROR = 0x8017
+ ,TE_SCI_LINK_ERROR = 0x0017
/**
* TE_SCI_UNABLE_TO_START_SEQUENCE
@@ -264,14 +271,14 @@ enum TransporterError {
* are exumed or no sequence has been created.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x8018
+ ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x18 | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_REMOVE_SEQUENCE
*
* Could not remove a sequence
*/
- ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x8019
+ ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x19 | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_CREATE_SEQUENCE
@@ -280,7 +287,7 @@ enum TransporterError {
* exempted. Must reboot.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x801a
+ ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x1a | TE_DO_DISCONNECT
/**
* TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR
@@ -288,7 +295,7 @@ enum TransporterError {
* Tried to send data on redundant link but failed.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x801b
+ ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x1b | TE_DO_DISCONNECT
/**
* TE_SCI_CANNOT_INIT_LOCALSEGMENT
@@ -297,7 +304,7 @@ enum TransporterError {
* gone wrong (no system resources). Must reboot.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x801c
+ ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x1c | TE_DO_DISCONNECT
/**
* TE_SCI_CANNOT_MAP_REMOTESEGMENT
@@ -306,7 +313,7 @@ enum TransporterError {
* Must reboot system.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x801d
+ ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x1d | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_UNMAP_SEGMENT
@@ -314,7 +321,7 @@ enum TransporterError {
* Cannot free the resources used by this segment (step 1).
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x801e
+ ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x1e | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_REMOVE_SEGMENT
@@ -324,7 +331,7 @@ enum TransporterError {
* to map more segment
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x801f
+ ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x1f | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT
@@ -332,15 +339,18 @@ enum TransporterError {
* Cannot disconnect from a remote segment.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
- ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x8020
+ ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x20 | TE_DO_DISCONNECT
+ /* Used 0x21 */
+ /* Used 0x22 */
};
/**
* Report error
*/
void
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode);
+reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode,
+ const char *info = 0);
void
transporter_recv_from(void* callbackObj, NodeId node);
diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp
index a225988d37f..93d718b8713 100644
--- a/ndb/src/common/transporter/SHM_Transporter.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.cpp
@@ -47,6 +47,9 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
shmKey(_shmKey),
shmSize(_shmSize)
{
+#ifndef NDB_WIN32
+ shmId= 0;
+#endif
_shmSegCreated = false;
_attached = false;
@@ -202,7 +205,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Create
if(!_shmSegCreated){
if (!ndb_shm_create()) {
- report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT);
+ make_error_info(buf, sizeof(buf));
+ report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
}
@@ -212,7 +216,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Attach
if(!_attached){
if (!ndb_shm_attach()) {
- report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
+ make_error_info(buf, sizeof(buf));
+ report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
}
@@ -224,7 +229,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
m_transporter_registry.m_shm_own_pid);
// Wait for ok from client
- if (s_input.gets(buf, 256) == 0)
+ DBUG_PRINT("info", ("Wait for ok from client"));
+ if (s_input.gets(buf, sizeof(buf)) == 0)
{
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
@@ -262,10 +268,8 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
SocketOutputStream s_output(sockfd);
char buf[256];
-#if 1
-#endif
-
// Wait for server to create and attach
+ DBUG_PRINT("info", ("Wait for server to create and attach"));
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("Server id %d did not attach",
@@ -293,7 +297,8 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
// Attach
if(!_attached){
if (!ndb_shm_attach()) {
- report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
+ make_error_info(buf, sizeof(buf));
+ report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("Failed attach of shm seg to node %d",
remoteNodeId));
@@ -310,6 +315,7 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
if (r) {
// Wait for ok from server
+ DBUG_PRINT("info", ("Wait for ok from server"));
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("No ok from server node %d",
@@ -330,8 +336,6 @@ bool
SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
{
if (!checkConnected()) {
- DBUG_PRINT("error", ("Already connected to node %d",
- remoteNodeId));
return false;
}
diff --git a/ndb/src/common/transporter/SHM_Transporter.hpp b/ndb/src/common/transporter/SHM_Transporter.hpp
index e7a76225471..b25f9e538db 100644
--- a/ndb/src/common/transporter/SHM_Transporter.hpp
+++ b/ndb/src/common/transporter/SHM_Transporter.hpp
@@ -170,6 +170,8 @@ private:
bool hasDataToRead() const {
return reader->empty() == false;
}
+
+ void make_error_info(char info[], int sz);
};
#endif
diff --git a/ndb/src/common/transporter/SHM_Transporter.unix.cpp b/ndb/src/common/transporter/SHM_Transporter.unix.cpp
index 28882324fc0..7277f9e13ef 100644
--- a/ndb/src/common/transporter/SHM_Transporter.unix.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.unix.cpp
@@ -26,6 +26,12 @@
#include <sys/ipc.h>
#include <sys/shm.h>
+void SHM_Transporter::make_error_info(char info[], int sz)
+{
+ snprintf(info,sz,"Shm key=%d sz=%d id=%d",
+ shmKey, shmSize, shmId);
+}
+
bool
SHM_Transporter::ndb_shm_create()
{
@@ -64,12 +70,30 @@ SHM_Transporter::checkConnected(){
struct shmid_ds info;
const int res = shmctl(shmId, IPC_STAT, &info);
if(res == -1){
- report_error(TE_SHM_IPC_STAT);
+ char buf[128];
+ int r= snprintf(buf, sizeof(buf),
+ "shmctl(%d, IPC_STAT) errno: %d(%s). ", shmId,
+ errno, strerror(errno));
+ make_error_info(buf+r, sizeof(buf)-r);
+ DBUG_PRINT("error",(buf));
+ switch (errno)
+ {
+ case EACCES:
+ report_error(TE_SHM_IPC_PERMANENT, buf);
+ break;
+ default:
+ report_error(TE_SHM_IPC_STAT, buf);
+ break;
+ }
return false;
}
if(info.shm_nattch != 2){
+ char buf[128];
+ make_error_info(buf, sizeof(buf));
report_error(TE_SHM_DISCONNECT);
+ DBUG_PRINT("error", ("Already connected to node %d",
+ remoteNodeId));
return false;
}
return true;
@@ -91,6 +115,8 @@ SHM_Transporter::disconnectImpl(){
if(isServer && _shmSegCreated){
const int res = shmctl(shmId, IPC_RMID, 0);
if(res == -1){
+ char buf[64];
+ make_error_info(buf, sizeof(buf));
report_error(TE_SHM_UNABLE_TO_REMOVE_SEGMENT);
return;
}
diff --git a/ndb/src/common/transporter/SHM_Transporter.win32.cpp b/ndb/src/common/transporter/SHM_Transporter.win32.cpp
index c289a85da0e..86029b17885 100644
--- a/ndb/src/common/transporter/SHM_Transporter.win32.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.win32.cpp
@@ -26,6 +26,12 @@
#include <windows.h>
+void SHM_Transporter::make_error_info(char info[], int sz)
+{
+ snprintf(info,sz,"Shm key=%d sz=%d",
+ shmKey, shmSize);
+}
+
bool
SHM_Transporter::connectServer(Uint32 timeOutMillis){
if(!_shmSegCreated)
diff --git a/ndb/src/common/transporter/Transporter.hpp b/ndb/src/common/transporter/Transporter.hpp
index c9f4e9bda42..9e8bbd687ee 100644
--- a/ndb/src/common/transporter/Transporter.hpp
+++ b/ndb/src/common/transporter/Transporter.hpp
@@ -161,7 +161,8 @@ protected:
TransporterRegistry &m_transporter_registry;
void *get_callback_obj() { return m_transporter_registry.callbackObj; };
void report_disconnect(int err){m_transporter_registry.report_disconnect(remoteNodeId,err);};
- void report_error(enum TransporterError err){reportError(get_callback_obj(),remoteNodeId,err);};
+ void report_error(enum TransporterError err, const char *info = 0)
+ { reportError(get_callback_obj(), remoteNodeId, err, info); };
};
inline
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index 3937f1fc98b..f0e50729f8d 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -1508,8 +1508,8 @@ TransporterRegistry::startReceiving()
{
DBUG_PRINT("error",("Install failed"));
g_eventLogger.error("Failed to install signal handler for"
- " SHM transporter errno: %d (%s)", errno,
- strerror(errno));
+ " SHM transporter, signum %d, errno: %d (%s)",
+ g_ndb_shm_signum, errno, strerror(errno));
}
}
#endif // NDB_SHM_TRANSPORTER
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index 0da7ac95309..7003d70e8b1 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -1823,11 +1823,14 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
/*******************************/
/* DISCONNECT_REP */
/*******************************/
+const char *lookupConnectionError(Uint32 err);
+
void Qmgr::execDISCONNECT_REP(Signal* signal)
{
jamEntry();
const DisconnectRep * const rep = (DisconnectRep *)&signal->theData[0];
const Uint32 nodeId = rep->nodeId;
+ const Uint32 err = rep->err;
c_connectedNodes.clear(nodeId);
NodeRecPtr nodePtr;
@@ -1838,10 +1841,17 @@ void Qmgr::execDISCONNECT_REP(Signal* signal)
jam();
break;
case ZINIT:
+ ndbrequire(false);
case ZSTARTING:
+ progError(__LINE__, NDBD_EXIT_CONNECTION_SETUP_FAILED,
+ lookupConnectionError(err));
+ ndbrequire(false);
case ZPREPARE_FAIL:
+ ndbrequire(false);
case ZFAIL_CLOSING:
+ ndbrequire(false);
case ZAPI_ACTIVE:
+ ndbrequire(false);
case ZAPI_INACTIVE:
ndbrequire(false);
}
diff --git a/ndb/src/kernel/error/ndbd_exit_codes.c b/ndb/src/kernel/error/ndbd_exit_codes.c
index 4d9a61d69d1..d4592f7ff82 100644
--- a/ndb/src/kernel/error/ndbd_exit_codes.c
+++ b/ndb/src/kernel/error/ndbd_exit_codes.c
@@ -95,6 +95,7 @@ static const ErrStruct errArray[] =
{NDBD_EXIT_SIGNAL_LOST, XIE, "Signal lost (unknown reason)"},
{NDBD_EXIT_ILLEGAL_SIGNAL, XIE,
"Illegal signal (version mismatch a possibility)"},
+ {NDBD_EXIT_CONNECTION_SETUP_FAILED, XCE, "Connection setup failed"},
/* Ndbcntr */
{NDBD_EXIT_RESTART_TIMEOUT, XCE,
diff --git a/ndb/src/kernel/vm/FastScheduler.cpp b/ndb/src/kernel/vm/FastScheduler.cpp
index 5c68cbe6480..ad24a6795a4 100644
--- a/ndb/src/kernel/vm/FastScheduler.cpp
+++ b/ndb/src/kernel/vm/FastScheduler.cpp
@@ -394,7 +394,8 @@ void print_restart(FILE * output, Signal* signal, Uint32 aLevel);
void FastScheduler::dumpSignalMemory(FILE * output)
{
- Signal signal;
+ SignalT<25> signalT;
+ Signal &signal= *(Signal*)&signalT;
Uint32 ReadPtr[5];
Uint32 tJob;
Uint32 tLastJob;
@@ -483,17 +484,17 @@ print_restart(FILE * output, Signal* signal, Uint32 aLevel)
*/
void
FastScheduler::reportDoJobStatistics(Uint32 tMeanLoopCount) {
- Signal signal;
+ SignalT<2> signalT;
+ Signal &signal= *(Signal*)&signalT;
+
memset(&signal.header, 0, sizeof(signal.header));
+ signal.header.theLength = 2;
+ signal.header.theSendersSignalId = 0;
+ signal.header.theSendersBlockRef = numberToRef(0, 0);
signal.theData[0] = NDB_LE_JobStatistic;
signal.theData[1] = tMeanLoopCount;
- memset(&signal.header, 0, sizeof(SignalHeader));
- signal.header.theLength = 2;
- signal.header.theSendersSignalId = 0;
- signal.header.theSendersBlockRef = numberToRef(0, 0);
-
execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
}
diff --git a/ndb/src/kernel/vm/TransporterCallback.cpp b/ndb/src/kernel/vm/TransporterCallback.cpp
index 0bdfcf16689..4ce460c1d94 100644
--- a/ndb/src/kernel/vm/TransporterCallback.cpp
+++ b/ndb/src/kernel/vm/TransporterCallback.cpp
@@ -39,6 +39,26 @@
*/
SectionSegmentPool g_sectionSegmentPool;
+struct ConnectionError
+{
+ enum TransporterError err;
+ const char *text;
+};
+
+static const ConnectionError connectionError[] =
+{
+ { TE_NO_ERROR, "No error"},
+ { TE_SHM_UNABLE_TO_CREATE_SEGMENT, "Unable to create shared memory segment"},
+ { (enum TransporterError) -1, "No connection error message available (please report a bug)"}
+};
+
+const char *lookupConnectionError(Uint32 err)
+{
+ int i= 0;
+ while ((Uint32)connectionError[i].err != err && (Uint32)connectionError[i].err != -1);
+ return connectionError[i].text;
+}
+
bool
import(Ptr<SectionSegment> & first, const Uint32 * src, Uint32 len){
/**
@@ -306,30 +326,54 @@ checkJobBuffer() {
}
void
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
+reportError(void * callbackObj, NodeId nodeId,
+ TransporterError errorCode, const char *info)
+{
#ifdef DEBUG_TRANSPORTER
- char buf[255];
- sprintf(buf, "reportError (%d, 0x%x)", nodeId, errorCode);
- ndbout << buf << endl;
+ ndbout_c("reportError (%d, 0x%x) %s", nodeId, errorCode, info ? info : "")
#endif
- if(errorCode == TE_SIGNAL_LOST_SEND_BUFFER_FULL){
+ DBUG_ENTER("reportError");
+ DBUG_PRINT("info",("nodeId %d errorCode: 0x%x info: %s",
+ nodeId, errorCode, info));
+
+ switch (errorCode)
+ {
+ case TE_SIGNAL_LOST_SEND_BUFFER_FULL:
+ {
+ char msg[64];
+ snprintf(msg, sizeof(msg), "Remote note id %d.%s%s", nodeId,
+ info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL,
- "", __FILE__,
- NST_ErrorHandler);
+ msg, __FILE__, NST_ErrorHandler);
}
-
- if(errorCode == TE_SIGNAL_LOST){
+ case TE_SIGNAL_LOST:
+ {
+ char msg[64];
+ snprintf(msg, sizeof(msg), "Remote node id %d,%s%s", nodeId,
+ info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST,
- "", __FILE__,
- NST_ErrorHandler);
+ msg, __FILE__, NST_ErrorHandler);
}
-
- if(errorCode & 0x8000){
+ case TE_SHM_IPC_PERMANENT:
+ {
+ char msg[128];
+ snprintf(msg, sizeof(msg),
+ "Remote node id %d.%s%s",
+ nodeId, info ? " " : "", info ? info : "");
+ ErrorReporter::handleError(NDBD_EXIT_CONNECTION_SETUP_FAILED,
+ msg, __FILE__, NST_ErrorHandler);
+ }
+ default:
+ break;
+ }
+
+ if(errorCode & & TE_DO_DISCONNECT){
reportDisconnect(callbackObj, nodeId, errorCode);
}
- Signal signal;
+ SignalT<3> signalT;
+ Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
@@ -345,6 +389,8 @@ reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
signal.header.theSendersSignalId = 0;
signal.header.theSendersBlockRef = numberToRef(0, globalData.ownId);
globalScheduler.execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
+
+ DBUG_VOID_RETURN;
}
/**
@@ -354,7 +400,8 @@ void
reportSendLen(void * callbackObj,
NodeId nodeId, Uint32 count, Uint64 bytes){
- Signal signal;
+ SignalT<3> signalT;
+ Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 3;
@@ -373,7 +420,8 @@ void
reportReceiveLen(void * callbackObj,
NodeId nodeId, Uint32 count, Uint64 bytes){
- Signal signal;
+ SignalT<3> signalT;
+ Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 3;
@@ -392,7 +440,8 @@ reportReceiveLen(void * callbackObj,
void
reportConnect(void * callbackObj, NodeId nodeId){
- Signal signal;
+ SignalT<1> signalT;
+ Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 1;
@@ -409,7 +458,10 @@ reportConnect(void * callbackObj, NodeId nodeId){
void
reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
- Signal signal;
+ DBUG_ENTER("reportDisconnect");
+
+ SignalT<sizeof(DisconnectRep)/4> signalT;
+ Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = DisconnectRep::SignalLength;
@@ -422,6 +474,8 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
rep->err = errNo;
globalScheduler.execute(&signal, JBA, CMVMI, GSN_DISCONNECT_REP);
+
+ DBUG_VOID_RETURN;
}
void
diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp
index 45543c5d174..33f8a9f25c0 100644
--- a/ndb/src/kernel/vm/VMSignal.hpp
+++ b/ndb/src/kernel/vm/VMSignal.hpp
@@ -42,6 +42,16 @@ struct NodeReceiverGroup {
NodeBitmask m_nodes;
};
+template <unsigned T> struct SignalT
+{
+ SignalHeader header;
+ SegmentedSectionPtr m_sectionPtr[3];
+ union {
+ Uint32 theData[T];
+ Uint64 dummyAlign;
+ };
+};
+
/**
* class used for passing argumentes to blocks
*/
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index a870c395bd2..98e5744fe32 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -150,7 +150,6 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", fixPortNumber, 0 }, // has to come after fixHostName
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName
{ "SCI", fixPortNumber, 0 }, // has to come after fixHostName
- { "SHM", fixShmKey, 0 },
/**
* fixExtConnection must be after fixNodeId
@@ -164,6 +163,8 @@ ConfigInfo::m_SectionRules[] = {
{ "*", fixDepricated, 0 },
{ "*", applyDefaultValues, "system" },
+ { "SHM", fixShmKey, 0 }, // has to come after apply default values
+
{ DB_TOKEN, checkLocalhostHostnameMix, 0 },
{ API_TOKEN, checkLocalhostHostnameMix, 0 },
{ MGM_TOKEN, checkLocalhostHostnameMix, 0 },
@@ -1798,7 +1799,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
- "0",
+ UNDEFINED,
"0",
STR_VALUE(MAX_INT_RNIL) },
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index 802e0785988..77750a3c3d0 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -63,13 +63,16 @@ TransporterFacade* TransporterFacade::theFacadeInstance = NULL;
*****************************************************************************/
void
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
+reportError(void * callbackObj, NodeId nodeId,
+ TransporterError errorCode, const char *info)
+{
#ifdef REPORT_TRANSPORTER
- ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d)",
- (int)nodeId, (int)errorCode);
+ ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d) %s",
+ (int)nodeId, (int)errorCode, info ? info : "");
#endif
- if(errorCode & 0x8000) {
- ndbout_c("reportError (%d, %d)\n", (int)nodeId, (int)errorCode);
+ if(errorCode & TE_DO_DISCONNECT) {
+ ndbout_c("reportError (%d, %d) %s", (int)nodeId, (int)errorCode,
+ info ? info : "");
((TransporterFacade*)(callbackObj))->doDisconnect(nodeId);
}
}