$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. -- [EMAIL PROTECTED]
RE: $r->register_cleanup limits?
> -Original Message- > From: Jim Woodgate [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 06, 2000 9:48 AM > To: [EMAIL PROTECTED] > Subject: $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. I'm afraid I don't know the answer, but I would be interested in knowing whether any of the *_timeout functions apply to the cleanup phase - the Timeout directive docs and the eagle book seem to imply that these are methods aimed at closing the data connection, and I thought the connection was over by the time cleanup is called... just more questions - sorry I can't be of help, though... --Geoff > > -- > [EMAIL PROTECTED] >
Re: $r->register_cleanup limits?
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 (gdb) where (gdb) source mod_perl-x.xx/.gdbinit (gdb) curinfo
Re: $r->register_cleanup limits (Problem Solved)
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! -- [EMAIL PROTECTED]