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