[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hong updated ZOOKEEPER-4299:
----------------------------
    Description: 
int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
 zoo_op_result_t *results, void_completion_t completion, const void *data)

{ struct RequestHeader h = \\{get_xid(), ZOO_MULTI_OP}

;
 struct MultiHeader mh = \{-1, 1, -1};
 struct oarchive *oa = create_buffer_oarchive();
 {color:#ff0000}completion_head_t clist = \{ 0 }; // not initialize for cond or 
lock{color}

int rc = serialize_RequestHeader(oa, "header", &h);

....

 

{color:#ff0000}queue_completion(&clist, entry, 0); //queue it will segment 
errors{color}

 

 

{color:#FF0000}// do lock or unlock which have not been initialized!!{color}
 static void queue_completion(completion_head_t *list, completion_list_t *c,
         int add_to_front)

{     lock_completion_list(list);     queue_completion_nolock(list, c, 
add_to_front);     unlock_completion_list(list); }

{color:#FF0000}// oh my god!!{color}
 int unlock_completion_list(completion_head_t *l)

{     p_thread_cond_broadcast(&l->cond);     return 
p_thread_mutex_unlock(&l->lock); }

  was:
int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
 zoo_op_result_t *results, void_completion_t completion, const void *data)
{
 struct RequestHeader h = \{get_xid(), ZOO_MULTI_OP};
 struct MultiHeader mh = \{-1, 1, -1};
 struct oarchive *oa = create_buffer_oarchive();
 {color:#FF0000}completion_head_t clist = \{ 0 }; // not initialize for cond or 
lock{color}

int rc = serialize_RequestHeader(oa, "header", &h);

....

 

{color:#FF0000}queue_completion(&clist, entry, 0); //queue it will segment 
errors{color}

 

 

// do lock or unlock which have not been initialized!!
static void queue_completion(completion_head_t *list, completion_list_t *c,
        int add_to_front)
{

    lock_completion_list(list);
    queue_completion_nolock(list, c, add_to_front);
    unlock_completion_list(list);
}
// oh my god!!
int unlock_completion_list(completion_head_t *l)
{
    p_thread_cond_broadcast(&l->cond);
    return p_thread_mutex_unlock(&l->lock);
}


> List head do not initialize before using it in zoo_amulti that will cause 
> segment errors.
> -----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-4299
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4299
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.5.4, 3.7.0, 3.6.2
>            Reporter: hong
>            Priority: Blocker
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
>  zoo_op_result_t *results, void_completion_t completion, const void *data)
> { struct RequestHeader h = \\{get_xid(), ZOO_MULTI_OP}
> ;
>  struct MultiHeader mh = \{-1, 1, -1};
>  struct oarchive *oa = create_buffer_oarchive();
>  {color:#ff0000}completion_head_t clist = \{ 0 }; // not initialize for cond 
> or lock{color}
> int rc = serialize_RequestHeader(oa, "header", &h);
> ....
>  
> {color:#ff0000}queue_completion(&clist, entry, 0); //queue it will segment 
> errors{color}
>  
>  
> {color:#FF0000}// do lock or unlock which have not been initialized!!{color}
>  static void queue_completion(completion_head_t *list, completion_list_t *c,
>          int add_to_front)
> {     lock_completion_list(list);     queue_completion_nolock(list, c, 
> add_to_front);     unlock_completion_list(list); }
> {color:#FF0000}// oh my god!!{color}
>  int unlock_completion_list(completion_head_t *l)
> {     p_thread_cond_broadcast(&l->cond);     return 
> p_thread_mutex_unlock(&l->lock); }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to