MySQL Forums
Forum List  »  NDB clusters

Timeout in executeNoBlobs() & Forcibly trying to rollback txn to try to clean up data node resources.
Posted by: Raghu DV
Date: September 20, 2017 12:37AM

I have got the following error, where it says it's a bug!!
I am trying to perform a simple multithreaded INSERT, UPDATE, READ, DELETE scenario.

Source Code ==============================================>
#include <mysql.h>
#include <mysqld_error.h>
#include <NdbApi.hpp>
// Used for cout
#include <stdio.h>
#include <iostream>
#include <cstdint>
#include <unistd.h>
#include <limits>
#include <climits>
#include <sys/syscall.h>
#include <cstring>
#include<thread>
#define gettid() syscall(SYS_gettid)

#define PRINT_ERROR(code,msg) \
std::cout << "Error in " << __FILE__ << ", line: " << __LINE__ \
<< ", code: " << code \
<< ", msg: " << msg << "." << std::endl
#define MYSQLERROR(mysql) { \
PRINT_ERROR(mysql_errno(&mysql),mysql_error(&mysql)); }
#define APIERROR(error) { \
PRINT_ERROR(error.code,error.message); }

struct St
{
int key;
int val;
};

void do_insert(Ndb & ,St);
void do_update(Ndb & ,St);
void do_delete(Ndb & ,St);
void do_read(Ndb &, St);

int main(int argc, char** argv)
{
int key = 0;
int value = 0;

if (argc != 3)
{
std::cout << "Arguments are <socket mysqld> <connect_string cluster> .\n";
exit(-1);
}
// ndb_init must be called first
ndb_init();

//char * mysqld_sock = argv[1];
const char *connection_string = argv[2];
// Object representing the cluster
Ndb_cluster_connection cluster_connection(connection_string);

// Connect to cluster management server (ndb_mgmd)
if (cluster_connection.connect(4 /* retries */,
5 /* delay between retries */,
1 /* verbose */))
{
std::cout << "Cluster management server was not ready within 30 secs.\n";
exit(-1);
}

// Optionally connect and wait for the storage nodes (ndbd's)
if (cluster_connection.wait_until_ready(30,0) < 0)
{
std::cout << "Cluster was not ready within 30 secs.\n";
exit(-1);
}

Ndb myNdb( &cluster_connection, "ndbtest" );
if (myNdb.init()) APIERROR(myNdb.getNdbError());

St st;
memset(&st, 0, sizeof(St));

while(1)
{
st.key = key++;
st.val = value++;
auto thread = std::thread(do_insert, std::ref(myNdb), st);
thread.detach();
usleep(1000);
}

ndb_end(0);
return 0;
}
/**************************************************************************
* Using 5 transactions, insert 10 tuples in table: (0,0),(1,1),...,(9,9) *
**************************************************************************/
void do_insert(Ndb & myNdb, St st)
{
std::cout << "Insert K:" << st.key << " V:" << st.val << std::endl;

const NdbDictionary::Dictionary* myDict= myNdb.getDictionary();
const NdbDictionary::Table *myTable= myDict->getTable("KV_STORE");

if (myTable == NULL)
APIERROR(myDict->getNdbError());
NdbTransaction *myTransaction= myNdb.startTransaction();
if (myTransaction == NULL) APIERROR(myNdb.getNdbError());

NdbOperation *myOperation= myTransaction->getNdbOperation(myTable);
if (myOperation == NULL) APIERROR(myTransaction->getNdbError());

myOperation->insertTuple();
myOperation->equal("ATTR1", st.key);
myOperation->setValue("ATTR2", st.val);

if(myTransaction->execute( NdbTransaction::Commit ) != 0)
APIERROR(myTransaction->getNdbError());

myNdb.closeTransaction(myTransaction);

auto thread = std::thread(do_update, std::ref(myNdb), st);
thread.detach();

}
/*****************************************************************
* Update the second attribute in half of the tuples (adding 10) *
*****************************************************************/
void do_update(Ndb & myNdb, St st)
{
std::cout << "Update K:" << st.key << " V:" << st.val+10 << std::endl;

const NdbDictionary::Dictionary* myDict= myNdb.getDictionary();
const NdbDictionary::Table *myTable= myDict->getTable("KV_STORE");

if (myTable == NULL)
APIERROR(myDict->getNdbError());
NdbTransaction *myTransaction= myNdb.startTransaction();
if (myTransaction == NULL) APIERROR(myNdb.getNdbError());

NdbOperation *myOperation= myTransaction->getNdbOperation(myTable);
if (myOperation == NULL) APIERROR(myTransaction->getNdbError());

myOperation->updateTuple();
myOperation->equal( "ATTR1", st.key);
myOperation->setValue( "ATTR2", st.val+10);

if( myTransaction->execute( NdbTransaction::Commit ) == -1 )
APIERROR(myTransaction->getNdbError());

myNdb.closeTransaction(myTransaction);

auto thread = std::thread(do_read, std::ref(myNdb), st);
thread.detach();

}

/*************************************************
* Delete one tuple (the one with primary key 3) *
*************************************************/
void do_delete(Ndb & myNdb, St st)
{

std::cout << "Delete K:" << st.key << std::endl;

const NdbDictionary::Dictionary* myDict= myNdb.getDictionary();
const NdbDictionary::Table *myTable= myDict->getTable("KV_STORE");

if (myTable == NULL)
APIERROR(myDict->getNdbError());

NdbTransaction *myTransaction= myNdb.startTransaction();
if (myTransaction == NULL) APIERROR(myNdb.getNdbError());

NdbOperation *myOperation= myTransaction->getNdbOperation(myTable);
if (myOperation == NULL) APIERROR(myTransaction->getNdbError());

myOperation->deleteTuple();
myOperation->equal( "ATTR1", st.key);

if (myTransaction->execute(NdbTransaction::Commit) == -1)
APIERROR(myTransaction->getNdbError());

myNdb.closeTransaction(myTransaction);
}
/*****************************
* Read and print all tuples *
*****************************/
void do_read(Ndb & myNdb, St st)
{
const NdbDictionary::Dictionary* myDict= myNdb.getDictionary();
const NdbDictionary::Table *myTable= myDict->getTable("KV_STORE");

if (myTable == NULL)
APIERROR(myDict->getNdbError());

NdbTransaction *myTransaction= myNdb.startTransaction();
if (myTransaction == NULL) APIERROR(myNdb.getNdbError());

NdbOperation *myOperation= myTransaction->getNdbOperation(myTable);
if (myOperation == NULL) APIERROR(myTransaction->getNdbError());

myOperation->readTuple(NdbOperation::LM_Read);
myOperation->equal("ATTR1", st.key);

NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());

if(myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError());

if (myTransaction->getNdbError().classification == NdbError::NoDataFound)
APIERROR(myTransaction->getNdbError());

myNdb.closeTransaction(myTransaction);

std::cout << "Read K:" << st.key << " V:" << myRecAttr->u_32_value() << std::endl;

auto thread = std::thread(do_delete, std::ref(myNdb), st);
thread.detach();
}


Output====================================================================>

bin/NdbTransactions /var/lib/mysql/mysql.sock 10.0.2.66 &
[1] 31239
[ndb@localhost src]$ Insert K:0 V:0
Insert K:1 V:1
Insert K:2 V:2
Update K:0 V:10
Insert K:3 V:3
Update K:1 V:11
Insert K:4 V:4
Update K:3 V:13
Insert K:5 V:5
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x15b42b0) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 142, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x15ce460) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 111, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
Update K:2 V:12
Update K:5 V:15
Insert K:6 V:6
Insert K:7 V:7
Read K:1 V:11
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x7f480c000900) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 203, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
Read K:3 V:13
Delete K:1
Delete K:3
Insert K:8 V:8
Insert K:9 V:9
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x15ce460) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 142, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x15ada70) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 175, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
2017-09-20 11:43:15 [NdbApi] ERROR -- WARNING: Timeout in executeNoBlobs() waiting for response from NDB data nodes. This should NEVER occur. You have likely hit a NDB Bug. Please file a bug.
2017-09-20 11:43:15 [NdbApi] ERROR -- Forcibly trying to rollback txn (0x15b42b0) to try to clean up data node resources.
Error in src/NdbTransactions.cc, line: 111, code: 4012, msg: Request ndbd time-out, maybe due to high load or communication problems.
Update K:6 V:16
Error in src/NdbTransactions.cc, line: 132, code: 4006, msg: Connect failure - out of connection objects (increase MaxNoOfConcurrentTransactions).

[1]+ Segmentation fault (core dumped) bin/NdbTransactions /var/lib/mysql/mysql.sock 10.0.2.66

Core file==================================================================>

gdb bin/NdbTransactions core.31239
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/ndb/cvs/ndb/src/bin/NdbTransactions...(no debugging symbols found)...done.
[New LWP 31268]
[New LWP 31262]
[New LWP 31239]
[New LWP 31240]
[New LWP 31241]
[New LWP 31242]
[New LWP 31243]
[New LWP 31244]
[New LWP 31252]
[New LWP 31260]
[New LWP 31263]
[New LWP 31264]
[New LWP 31265]
[New LWP 31266]
[New LWP 31267]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `bin/NdbTransactions /var/lib/mysql/mysql.sock 10.0.2.66'.
Program terminated with signal 11, Segmentation fault.
#0 NdbTransaction::getNdbOperation (this=0x0, tab=0x7f48140166c0, aNextOp=0x0)
at /export/home/pb2/build/sb_0-23963488-1498205878.14/rpm/BUILD/mysql-cluster-com-7.5.7/mysql-cluster-com-7.5.7/storage/ndb/src/ndbapi/NdbTransaction.cpp:1556
1556 /export/home/pb2/build/sb_0-23963488-1498205878.14/rpm/BUILD/mysql-cluster-com-7.5.7/mysql-cluster-com-7.5.7/storage/ndb/src/ndbapi/NdbTransaction.cpp: No such file or directory.
Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.el7.x86_64 libgcc-4.8.5-16.el7.x86_64 libstdc++-4.8.5-16.el7.x86_64
(gdb) bt
#0 NdbTransaction::getNdbOperation (this=0x0, tab=0x7f48140166c0, aNextOp=0x0)
at /export/home/pb2/build/sb_0-23963488-1498205878.14/rpm/BUILD/mysql-cluster-com-7.5.7/mysql-cluster-com-7.5.7/storage/ndb/src/ndbapi/NdbTransaction.cpp:1556
#1 0x0000000000402607 in do_update(Ndb&, St) ()
#2 0x0000000000403d44 in std::thread::_Impl<std::_Bind_simple<void (*(std::reference_wrapper<Ndb>, St))(Ndb&, St)> >::_M_run() ()
#3 0x00007f482b8362b0 in ?? () from /lib64/libstdc++.so.6
#4 0x00007f482cddae25 in start_thread () from /lib64/libpthread.so.0
#5 0x00007f482af9e34d in clone () from /lib64/libc.so.6

Any help!!!

Options: ReplyQuote


Subject
Views
Written By
Posted
Timeout in executeNoBlobs() & Forcibly trying to rollback txn to try to clean up data node resources.
4230
September 20, 2017 12:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.