Skip Menu |

This queue is for tickets about the Gearman-Server CPAN distribution.

Report information
The Basics
Id: 70728
Status: resolved
Priority: 0/
Queue: Gearman-Server

People
Owner: Nobody in particular
Requestors: marsh_yamazaki [...] yahoo.co.jp
Cc: PLICEASE [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Memory leak of sleepers_list
Date: Mon, 5 Sep 2011 16:08:28 +0900 (JST)
To: bug-Gearman-Server [...] rt.cpan.org
From: marsh_yamazaki [...] yahoo.co.jp
hello, Connecting/disconnecting repeatedly from worker cause memory leak @Gearman-Server-1.11. In on_client_sleep() @Server.pm, Gearman::Server::Client object($cl) is stored in $self->{sleepers_list}{$cd} array, and map is created at $self->{sleepers}{$cd} hash. In close() @Server/Client.pm, $self->{server}{sleepers}->{job}->{$self} is deleted. But $self still remains in $self->{server}{sleepers_list}->{$job}. So connecting/disconnecting from worker increase sleepers_list->{$job} array. Request $job from client will delete $self->{sleepers}{$func} in _wake_up_some @Server.pm. But without the request, Gearman::Server::Client object is never deleted. I think sleepers_list should be cleaned at close(). === --- /usr/lib/perl5/vendor_perl/5.8.8/Gearman/Server/Client.pm 2009-10-05 10:36:10.000000000 +0900 +++ /tmp/Client.pm 2011-09-05 15:18:38.000000000 +0900 @@ -92,9 +92,21 @@ # Remove self from sleepers, otherwise it will be leaked if another worker # for the job never connects. my $sleepers = $self->{server}{sleepers}; + my $sleepers_list = $self->{server}{sleepers_list}; for my $job (@{ $self->{can_do_list} }) { my $sleeping = $sleepers->{$job}; delete $sleeping->{$self}; + + my $new_sleepers_list; + for my $client (@{$sleepers_list->{$job}}) { + push @{$new_sleepers_list}, $client unless $sleeping->{$client}; + } + if ($new_sleepers_list) { + $self->{server}{sleepers_list}->{$job} = $new_sleepers_list; + } else { + delete $self->{server}{sleepers_list}->{$job}; + } + delete $sleepers->{$job} unless %$sleeping; } === best regard.
It appears that this patch has been applied to the current version on CPAN, so can this ticket be closed?
the patch was already applied in v1.12