[nanomsg] Re: [PATCH] Fix more list handling issues

  • From: Nir Soffer <nirsof@xxxxxxxxx>
  • To: Martin Sustrik <sustrik@xxxxxxxxxx>
  • Date: Sat, 9 Mar 2013 11:37:46 +0200

On Mar 9, 2013, at 7:04 AM, Martin Sustrik wrote:
> The test module is missing from the patch.

Sent as another patch to the list.

> Aside of that, do you have a test case to trigger the timer error you 
> mention? Removal of uninitialised item should not even be attempted. If 
> possible, I would like to have a look at the problem.

If you disable the initialization of the timeout handle and the check before 
removing it:

diff --git a/src/utils/aio_posix.inc b/src/utils/aio_posix.inc
index 369ec40..90b30fa 100644
--- a/src/utils/aio_posix.inc
+++ b/src/utils/aio_posix.inc
@@ -50,7 +50,7 @@ void nn_timer_init (struct nn_timer *self, const struct 
nn_cp_sink **sink,
     self->cp = cp;
     
     /*  This handle does not belong to any list yet. */
-    nn_list_item_nil (&self->hndl.list);
+    //nn_list_item_nil (&self->hndl.list);
 
     self->active = 0;
 }
diff --git a/src/utils/timeout.c b/src/utils/timeout.c
index 0354530..b2bc8b6 100644
--- a/src/utils/timeout.c
+++ b/src/utils/timeout.c
@@ -68,8 +68,8 @@ int nn_timeout_rm (struct nn_timeout *self, struct 
nn_timeout_hndl *hndl)
     int first;
 
     /*  Ignore if handle is not in the timeouts list. */
-    if (nn_list_item_isnil (&hndl->list))
-        return 0;
+    //if (nn_list_item_isnil (&hndl->list))
+    //    return 0;
 
     /*  If it was the first timeout that was removed, the actual waiting time
         may have changed. We'll thus return 1 to let the user know. */


Then few tests fails:

 3/25 Test  #3: ipc ..............................***Exception: Other  0.25 sec
Assertion failed: !nn_list_item_isnil (item) 
(/Users/nirs/nanomsg/src/utils/list.c:102)

      Start  5: tcp
 5/25 Test  #5: tcp ..............................***Exception: Other  0.16 sec
Assertion failed: !nn_list_item_isnil (item) 
(/Users/nirs/nanomsg/src/utils/list.c:102)

 9/25 Test  #9: reqrep ...........................***Exception: Other  0.03 sec
Assertion failed: !nn_list_item_isnil (item) 
(/Users/nirs/nanomsg/src/utils/list.c:102)

      Start 12: survey
12/25 Test #12: survey ...........................***Exception: Other  0.56 sec
Assertion failed: !nn_list_item_isnil (item) 
(/Users/nirs/nanomsg/src/utils/list.c:102)



Other related posts: