zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfthom <mft...@gmail.com>
Subject c binding asynchronous get problem
Date Tue, 07 Feb 2012 20:12:18 GMT
I'm having trouble with a c client doing an asynchronous get.  This code:
#include <zookeeper.h>
#include <stdio.h>
#include <pthread.h>
#include <assert.h>
char *Z = "/fuzz/targets/targ0000000002";

int main(int argc, char **argv) {
        static zhandle_t *zh = NULL;
        char ip[8192];
        int len;
        struct Stat stat;
        printf("here here \n");
        zh = zookeeper_init("172.20.110.100:2181", NULL, 30000, 0, 0, 0);
        int rc = zoo_get(zh, Z, 0, ip, &len, &stat);
        if(rc != ZOK)
        {
                printf("crash\n");
        }else{
                printf("ip is %s len is %d\n", ip, len);
        }
}

will fail or work depending on the size of the ip array.  1024 works
usually.  8292 fails.
The failure symptom is that it returns a len of zero bytes instead of the
data (a simple IP address).

And sometimes, zookeeper seg faults while doing memcpy.

Thanks,
--Mike

--
View this message in context: http://zookeeper-user.578899.n2.nabble.com/c-binding-asynchronous-get-problem-tp7263621p7263621.html
Sent from the zookeeper-user mailing list archive at Nabble.com.

Mime
View raw message