Welcome Guest, Not a member yet? Register   Sign In
*thread moved*
#1

[eluser]ipsod[/eluser]
Hi.

I'm doing image caching that can take a long time, but after about 30 seconds I get a 404 not found error. I run set_time_limit(0) in the controller before this.

This wasn't happening before I had my server switched to FastCGI, but I've been changing/adding a lot of code, too.

Here's the log (all messages) of what's happening. It caches about 200 folders before giving a 404 error, then loads another 50 still.
Code:
(more above)...
DEBUG - 2011-03-10 03:10:25 --> Loaded cache for product 183
DEBUG - 2011-03-10 03:10:26 --> Loaded cache for product 184
DEBUG - 2011-03-10 03:10:26 --> Loaded cache for product 185
DEBUG - 2011-03-10 03:10:26 --> Loaded cache for product 186
DEBUG - 2011-03-10 03:10:26 --> Loaded cache for product 187
DEBUG - 2011-03-10 03:10:26 --> Loaded cache for product 188
DEBUG - 2011-03-10 03:10:26 --> Config Class Initialized
DEBUG - 2011-03-10 03:10:26 --> Hooks Class Initialized
DEBUG - 2011-03-10 03:10:26 --> Utf8 Class Initialized
DEBUG - 2011-03-10 03:10:26 --> UTF-8 Support Enabled
DEBUG - 2011-03-10 03:10:26 --> URI Class Initialized
DEBUG - 2011-03-10 03:10:26 --> Router Class Initialized
ERROR - 2011-03-10 03:10:26 --> 404 Page Not Found --> 500_shtml
DEBUG - 2011-03-10 03:10:27 --> Loaded cache for product 189
DEBUG - 2011-03-10 03:10:27 --> Loaded cache for product 190
DEBUG - 2011-03-10 03:10:27 --> Loaded cache for product 191
DEBUG - 2011-03-10 03:10:27 --> Loaded cache for product 192
DEBUG - 2011-03-10 03:10:27 --> Loaded cache for product 193
DEBUG - 2011-03-10 03:10:28 --> Loaded cache for product 194
DEBUG - 2011-03-10 03:10:28 --> Loaded cache for product 195
DEBUG - 2011-03-10 03:10:28 --> Loaded cache for product 196
... (more below)

Help please?
#2

[eluser]ipsod[/eluser]
Um... I added <b>clearstatcache();</b> after each iteration, no help

Then, I changed it to <b>clearstatcache(TRUE);</b> (seems valid according to man page?), and it threw this error every go around, but either it fixed it or the process of throwing an error fixed it.

Code:
A PHP Error was encountered

Severity: Warning

Message: Wrong parameter count for clearstatcache()

Filename: models/product.php

Line Number: 334

Still need help.
#3

[eluser]ipsod[/eluser]
bump
#4

[eluser]WanWizard[/eluser]
can't comment without seeing your code.

It looks like you're sending a redirect to the browser to load the 404 page. The browser will disconnect and load the new page, but that doesn't mean the server process stops.
#5

[eluser]ipsod[/eluser]
Thank you for the response.

There aren't any redirects in my end of the code. Also, the URL doesn't change, so I don't think it's a redirect.

Here's the controller:
Code:
public function cache_all() {
        $p = new Product();
        $p->get();
        $p->cache_images();
    }

I figured out that it's the flush that happens with the errors that fixes it. Added flush() after each iteration and it also fixed it, so the loop (inside function cache_images() on Product dmz model) looks like this with the flush:
Code:
$image_cacher = new image_cache($params);

        $first = 1;
        foreach( $this as $p ) {
            echo $p->sku.'<br/>';
            flush();
            log_message('debug', 'Loaded cache for product '.$p->id);
            $p->images = $image_cacher->cache_folder($p);
            if( $first ) {
                $this->images = $p->images;
                $first = 0;
            }
        }

There are several hundred lines of code otherwise, and I'll post it if we can't figure it out, but I don't think it's on my side. It fails on a seemingly random iteration each time, so it's not like it's coming to an image that it has trouble with or something. Also, it works fine if I only do a limited number of products ( $p->get(10) ). I think it must be reaching a time limit of some sort, but I've got nothing like that on my side of the code.
#6

[eluser]Unknown[/eluser]
I still cant doSad(
#7

[eluser]talentsfromindia[/eluser]
This error is because the page may have some error may be in syntax which is not directing it to the page,the error may be with the spaces or with some unwanted dot.
#8

[eluser]ipsod[/eluser]
Ok, I used new code just to test the theory.

This controller function gives me the same result:

Code:
function test() {
        for( $i=1000; $i>0; $i-- ) {
            $file = FCPATH.'/files/products/1/1.jpg';
            $image = new Imagick($file);
            $image->thumbnailImage($i, 0);
            //echo 'hey'; flush();
        }
    }

When the echo/flush line is uncommented, everything goes as expected. When commented, I get a CI generated 404 file not found error after about 30 seconds.
#9

[eluser]RJ[/eluser]
Did you figure this out? A time or memory limit problem perhaps? Ini_set() can help solve those problems.
http://php.net/manual/en/function.ini-set.php




Theme © iAndrew 2016 - Forum software by © MyBB