Bug #41406 Events segfault with NDBAPI when watching a primary key
Submitted: 11 Dec 2008 17:28
Reporter: Andrew Hutchings Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S2 (Serious)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql-5.1-telco-6.3.19

[11 Dec 2008 17:28] Andrew Hutchings
Description:
When using ndbapi to watch events it segfaults on inserts/updates/deletes.  The table used is:

CREATE TABLE `subscriber` (
  `subsid` int(11) NOT NULL,
  `app` varchar(16) NOT NULL,
  PRIMARY KEY (`subsid`)
) ENGINE=ndbcluster 

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182904830368 (LWP 16905)]
NdbEventOperationImpl::receive_event (this=0x52caa0)
    at ../../../../storage/ndb/include/ndbapi/NdbRecAttr.hpp:455
455	  m_size_in_bytes= -1;
Current language:  auto; currently c++
(gdb) bt
#0  NdbEventOperationImpl::receive_event (this=0x52caa0)
    at ../../../../storage/ndb/include/ndbapi/NdbRecAttr.hpp:455
#1  0x0000002a9594edb0 in NdbEventBuffer::nextEvent (this=0x521950)
    at NdbEventOperationImpl.cpp:1312
#2  0x0000002a9592aeab in Ndb::nextEvent (this=Variable "this" is not available.
) at Ndb.cpp:1865
#3  0x0000000000401e6c in main ()

How to repeat:
1. Run program
2. insert into subscriber set subsid=2, app='test2';
[11 Dec 2008 20:45] Tomas Ulin
this case should be handled in the code but all our testing also uses the pre values so we don't hit this beg,  suggest you do too until bug is fixed:

          attrSidPre = event_op->getPreValue("subsid");
          attrAppPre = event_op->getPreValue("app");

so the reason you hit this is that you do not get the "pre" values as well

BTW, getting prevalues also fixes bug 41405, so that the update events get propagated correctly
[4 Nov 2009 9:16] Jonas Oreland
EventAPI is not officially supported
There is execellent work-around,
decreasing prio to p4