[rhmessaging-commits] rhmessaging commits: r2038 - in store/trunk/cpp/lib: jrnl and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon May 12 17:26:45 EDT 2008


Author: kpvdr
Date: 2008-05-12 17:26:45 -0400 (Mon, 12 May 2008)
New Revision: 2038

Modified:
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/jrnl/enq_rec.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
   store/trunk/cpp/lib/jrnl/rmgr.cpp
Log:
Fixed intermittent core on shutdown after reads from store. Addresses one of the issues in BZ446096

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2008-05-12 17:23:00 UTC (rev 2037)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2008-05-12 21:26:45 UTC (rev 2038)
@@ -104,6 +104,7 @@
     if (_xidp) {
         ::free(_xidp);
         _xidp = 0;
+        _datap = 0;
     } else if (_datap) {
         ::free(_datap);
         _datap = 0;
@@ -231,6 +232,7 @@
         if (_xidp) {
             ::free(_xidp);
             _xidp = 0;
+            _datap = 0;
         } else if (_datap) {
             ::free(_datap);
             _datap = 0;

Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp	2008-05-12 17:23:00 UTC (rev 2037)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp	2008-05-12 21:26:45 UTC (rev 2038)
@@ -512,7 +512,7 @@
 std::size_t
 enq_rec::get_xid(void** const xidpp)
 {
-    if (!_buff)
+    if (!_buff || !_enq_hdr._xidsize)
     {
         *xidpp = 0;
         return 0;

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-05-12 17:23:00 UTC (rev 2037)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-05-12 21:26:45 UTC (rev 2038)
@@ -392,6 +392,10 @@
         * present (ie an empty record), then no memory is allocated, and both pointers will be NULL.
         * In this case, there is no need to free memory.
         *
+        * TODO: Fix this lousy interface. The caller should NOT be required to clean up these
+        * pointers! Rather use a struct, or better still, let the data token carry the data and
+        * xid pointers and lengths, and have the data token both allocate and delete.
+        *
         * \param datapp Pointer to pointer that will be set to point to memory allocated and
         *     containing the data. Will be set to NULL if the call fails or there is no data
         *     in the record.

Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-05-12 17:23:00 UTC (rev 2037)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-05-12 21:26:45 UTC (rev 2038)
@@ -124,6 +124,8 @@
         external = _enq_rec.is_external();
         return res;
     }
+
+    set_params_null(datapp, dsize, xidpp, xidsize);
     _hdr.reset();
     // Read header, determine next record type
     while (true)




More information about the rhmessaging-commits mailing list