Skip Menu |

This queue is for tickets about the AnyEvent CPAN distribution.

Report information
The Basics
Id: 44575
Status: resolved
Priority: 0/
Queue: AnyEvent

People
Owner: Nobody in particular
Requestors: zwon [...] trinitum.org
Cc:
AdminCc:

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



Subject: Memory leak in AnyEvent::Handler for TLS connections
Hey! While write test for our web-application using AnyEvent::HTTP, I've discovered that it badly leaks a memory if I using https. Attached script may be used to reproduce the problem. It's memory usage grows rapidly even after maximum number of connections reached. I investigated and found that the problem is in the AnyEvent::Handler code. Patch for AnyEvent::Handler is attached. It solves problem for me. Great code btw. Thanks.
Subject: foo.pl
#!/usr/bin/perl use strict; use warnings; use EV; use AnyEvent; use AnyEvent::HTTP; my $url = "https://127.0.0.1/"; #my $url = "http://127.0.0.1/"; my @sessions; my $w = AnyEvent->timer( after => 1, interval => 1, cb => \&start_sessions ); my $total = 0; my @watchers; EV::loop; sub start_sessions { warn "Total: $total\n"; return if $total > 2000; my $count = 70; for my $i ( 1 .. $count ) { my $num = $total; http_get $url, sub { http_callback($num) }; $total++; } } sub http_callback { my $num = shift; warn "42!\n" if $num == 42; my ( $data, $headers ) = @_; $watchers[$num] = AnyEvent->timer( after => 30, cb => sub { timer_callback($num) }, ); } sub timer_callback { my $num = shift; http_get $url, sub { http_callback($num) }; }
Subject: AnyEvent-Handle_freetls.patch
--- lib/AnyEvent/Handle.pm.orig 2009-03-25 18:55:41.000000000 +0300 +++ lib/AnyEvent/Handle.pm 2009-03-25 18:56:45.000000000 +0300 @@ -1475,7 +1475,7 @@ } sub DESTROY { - my $self = shift; + my ($self) = @_; &_freetls;
Subject: Re: [rt.cpan.org #44575] Memory leak in AnyEvent::Handler for TLS connections
Date: Thu, 26 Mar 2009 06:12:50 +0100
To: "Pavel I. Shaydo via RT" <bug-AnyEvent [...] rt.cpan.org>
From: Marc Lehmann <schmorp [...] schmorp.de>
Hi! You sent a possible bug report on or via rt.cpan.org. Please read this mail carefully if you want to be heard. Most likely, your report will be ignored. Please close the ticket again and sent it to the official contact address for the module in question (or send it to rt.cpan.org@schmorp.de). Why is this necessary? rt.cpan.org has many deficiencies which makes it tedious and hard to use, increasing the workload on the people who provide all the perl modules you probably appreciate (and that is really to be avoided - module authors should be able to invest all their time into improving their modules and not fighting with rt.cpan.org's bugs). Still, for some people, rt.cpan.org is useful to have, and some people even like it and really want to use it. That is fine, too. Unfortunately, the designers of rt.cpan.org didn't make their "service" optional - you can neither opt-in nor opt-out of rt.cpan.org as a module author. Just like a spammer, rt.cpan.org forces its "service" (whether wanted or unwanted) on everybody. Just like a spammer, they don't care for the people they actively hurt. Just like a spammer, they don't don't care to fix these issues and make their "service" ethically acceptable. You cannot even configure it to redirect tickers to somewhere else. Unfortunately, ignoring rt.cpan.org is not an option either: for people reporting possible bugs there is no indication that their report will be ignored, and for module authors it means they miss possibly vital bug reports (and of course it's a great impression if rt.cpan.org has lots of bug reports that are unanswered, making a module unmaintained when in fact the opposite might be true). This is why it is important that you delete your ticket again. I am sorry that this wasted a bit of your time, but please understand that I am just as much a victim as you are - the problem is the unethical stance of the rt.cpan.org providers who force their "service" on everybody. Please redirect your bug report as stated in the beginning of this mail, and please consider petitioning the rt.cpan.org providers to stop their unethical behaviour and allow opt-in, opt-out, or some redirect option. Thanks a lot, Marc Lehmann <rt.cpan.org@schmorp.de>
Sent mail directly to author as requested -- Pavel Shaydo