Browse Source

ZOOKEEPER-804. c unit tests failing due to "assertion cptr failed" (michi mutsuzaki via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@1004844 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 14 years ago
parent
commit
51cc82c2fe
2 changed files with 12 additions and 0 deletions
  1. 3 0
      CHANGES.txt
  2. 9 0
      src/c/src/zookeeper.c

+ 3 - 0
CHANGES.txt

@@ -100,6 +100,9 @@ BUGFIXES:
 
   ZOOKEEPER-846. zookeeper client doesn't shut down cleanly on the close call
   (phunt)
+  
+  ZOOKEEPER-804. c unit tests failing due to "assertion cptr failed" (michi
+  mutsuzaki via mahadev)
 
 IMPROVEMENTS:
   ZOOKEEPER-724. Improve junit test integration - log harness information 

+ 9 - 0
src/c/src/zookeeper.c

@@ -1949,6 +1949,15 @@ int zookeeper_process(zhandle_t *zh, int events)
             int rc = hdr.err;
             /* Find the request corresponding to the response */
             completion_list_t *cptr = dequeue_completion(&zh->sent_requests);
+
+            /* [ZOOKEEPER-804] Don't assert if zookeeper_close has been called. */
+            if (zh->close_requested == 1) {
+                if (cptr) {
+                    destroy_completion_entry(cptr);
+                    cptr = NULL;
+                }
+                return ZINVALIDSTATE;
+            }
             assert(cptr);
             /* The requests are going to come back in order */
             if (cptr->xid != hdr.xid) {