Hi Robert,
 This looks like a bug. Please feel free to file a jira for this. Am not
sure if Chris (Darroch the author of the perl api) or some one else will
pick it up to debug this, but creating a jira would be the first step.

Thanks
mahadev


On 12/13/10 3:54 PM, "Robert J. Powers" <[email protected]> wrote:

> Hello,
> 
> I'm trying to get a proof of concept up and running
> where I'm using zookeeper_c_client and ypan/perl-Net-Zookeeper
> to set a watch on the children of my /queue znode.
> 
> It crashes or wedges itself sporadically when I try to
> call get_children with a watch set.
> 
> I've tried different os images of rhel (4.8 and 5.3),
> different versions of zookeeper_c_client from dist, building
> the latest c client from apache.org, various versions of the server,
> rewriting my code 30 times, etc.
> 
> It seems to be thread related. When it wedges itself the whole perl
> process seems to be wedged. Sometimes I see this:
> 
>   assertion botched (free()ed/realloc()ed-away memory was overwritten?):
> !(MallocCfg[MallocCfg_filldead] && MallocCfg[MallocCfg_fillcheck]) ||
> !cmp_pat_4bytes((unsigned char*)(p + 1), (((1 << ((bucket) >> 0)) + ((bucket
> >= 15 * 1) ? 4096 : 0)) - (sizeof(union overhead) + sizeof (unsigned int))) +
> sizeof (unsigned int), fill_deadbeef) (malloc.c:1536)
> 
> I managed to get a stack trace
> 
> Program received signal SIGABRT, Aborted.
> 0xffffe410 in __kernel_vsyscall ()
> (gdb) where
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xf7b8ed80 in raise () from /lib/libc.so.6
> #2  0xf7b90691 in abort () from /lib/libc.so.6
> #3  0xf7d6d53f in botch (diag=0xa <Address 0xa out of bounds>,
>     s=0xf7ef42e8 "!(MallocCfg[MallocCfg_filldead] &&
> MallocCfg[MallocCfg_fillcheck]) || !cmp_pat_4bytes((unsigned char*)(p + 1),
> (((1 << ((bucket) >> 0)) + ((bucket >= 15 * 1) ? 4096 : 0)) - (sizeof(union
> overhead) + s"..., file=0xf7ef4119 "malloc.c", line=1536) at malloc.c:1327
> #4  0xf7d6d97a in Perl_malloc (nbytes=15530) at malloc.c:1535
> #5  0xf7d6f974 in Perl_calloc (elements=1, size=0) at malloc.c:2314
> #6  0xf7929eca in _zk_create_watch (my_perl=0x0) at ZooKeeper.xs:204
> #7  0xf7929f8f in _zk_acquire_watch (my_perl=0x0) at ZooKeeper.xs:240
> #8  0xf793450b in XS_Net__ZooKeeper_watch (my_perl=0x889c008, cv=0x89db8b4) at
> ZooKeeper.xs:2035
> #9  0xf7e1dd67 in Perl_pp_entersub (my_perl=0x889c008) at pp_hot.c:2847
> #10 0xf7de47ce in Perl_runops_debug (my_perl=0x889c008) at dump.c:1931
> #11 0xf7e0d856 in perl_run (my_perl=0x889c008) at perl.c:2384
> #12 0x08048ace in main (argc=2, argv=0xffe11814, env=0xffe11820) at
> perlmain.c:113
> 
> The code to reproduce:
> 
>   my $root = '/queue';
>   my $timeout = 20*1000;
>   my $zkc = Net::ZooKeeper->new('localhost:2181');
> 
>   while (1) {
>     print "Retrieving $root\n";
>     my $child_watch = $zkc->watch('timeout' => $timeout);
> 
>     my @children = $zkc->get_children($root, watch=>$child_watch);
>     if (scalar(@children)) {
>       return @children if (rand(1) > 0.75);
>     } else {
>       print " - No Children.\n";
>     }
>     print "Time to wait for the Children.\n";
>     if ($child_watch->wait()) {
>       print "watch triggered on node $root:\n";
>       print "  event: $child_watch->{event}\n";
>       print "  state: $child_watch->{state}\n";
>     } else {
>       print "watch timed out\n";
>     }
>   }
> 
> Any ideas?
> 
> 
> 
> 

Reply via email to