You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jim Woodgate <wo...@realtime.net> on 2000/06/06 15:48:24 UTC
$r->register_cleanup limits?
In a module I'm using register_cleanup so the client doesn't need to
wait for me to do a bunch of work. It basically does this:
foreach (@images) {
unless (-f $thumb{$_}) {
&create_thumb($_);
$r->register_cleanup(sub {&create_more_sizes($_, ...)});
}
}
create_more_sizes will create various additional sizes to scale down a
large picture.
This seems to work really well unless there is a large set of images,
then the cleanup handler doesn't get all the way through. I don't see
any warnings/errors. (And unfortunately since the thumbnail is
created the next time someone visits create_more_sizes won't get
called unless I do explicit checks, which would cause me to actually
read the images and I was hoping to avoid that)
Anyway I'm not sure if I'm hitting a limit on the amount of time it
is taking or if I'm just registering too many cleanups.
I was thinking of $r->reset_timeout() as the first line of
create_more_size(), but thought I would check with the list first as I
don't fully understand the ramifications.
--
woody@bga.com
Re: $r->register_cleanup limits (Problem Solved)
Posted by Jim Woodgate <wo...@realtime.net>.
Doug MacEachern writes:
> there's no limit the number of cleanups you can register, but i would
> still push the sub {}'s into an array and register a single cleanup to
> iterate over them.
you're right that wasn't the problem, I was passing the same
Image::Magick reference to each subroutine, and as it read in pictures
it kept using more and more memory until it ran out of and killed the
process.
I did as you suggested though and now there's only one cleanup,
thanks!
--
woody@bga.com
Re: $r->register_cleanup limits?
Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 6 Jun 2000, Jim Woodgate wrote:
>
> In a module I'm using register_cleanup so the client doesn't need to
> wait for me to do a bunch of work. It basically does this:
>
> foreach (@images) {
> unless (-f $thumb{$_}) {
> &create_thumb($_);
> $r->register_cleanup(sub {&create_more_sizes($_, ...)});
> }
> }
there's no limit the number of cleanups you can register, but i would
still push the sub {}'s into an array and register a single cleanup to
iterate over them.
> create_more_sizes will create various additional sizes to scale down a
> large picture.
>
> This seems to work really well unless there is a large set of images,
> then the cleanup handler doesn't get all the way through. I don't see
> any warnings/errors. (And unfortunately since the thumbnail is
> created the next time someone visits create_more_sizes won't get
> called unless I do explicit checks, which would cause me to actually
> read the images and I was hoping to avoid that)
>
> Anyway I'm not sure if I'm hitting a limit on the amount of time it
> is taking or if I'm just registering too many cleanups.
>
> I was thinking of $r->reset_timeout() as the first line of
> create_more_size(), but thought I would check with the list first as I
> don't fully understand the ramifications.
i don't think $r->*_timeout will work properly in a cleanup, but alarm +
eval {} should be fine. if you want to see where it's stuck, try this:
% gdb httpd <pid of spinning process>
(gdb) where
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) curinfo