Forums / Developer / Import script timing out (?) after 100 seconds

Import script timing out (?) after 100 seconds

Author Message

Eirik Alfstad Johansen

Tuesday 10 October 2006 12:28:23 pm

Me again, :)

I have an import script which constructs content objects and nodes in eZP. After aprox 101 seconds (three tests show between 101.482512951 and 101.839282036 seconds) the script stops and an no result is sent to the browser. This happens somewhere between the 277th and 279th imported product, so it doesn't seem to be related to any input data failure (I know this beause I send data to the error log for each imported object as the script runs)

The max_execution_time of the server is set to 30, but in the script, I use set_time_limit(300).

I've gone through all the log files, but none of them give any indication as to what is happening.

Does anyone have any idea?

Thanks in advance !

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Kristian Hole

Tuesday 10 October 2006 3:00:08 pm

Hi Eirik.

Check the apache-logs to see if you have a seg-fault. Then it's most likely the reference bug i PHP 4.3.

Otherwise i would recommend to run the import as a cronjob, since it does not run with a timeout there.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Eirik Alfstad Johansen

Tuesday 10 October 2006 10:04:36 pm

Hi Kristian,

As I said, I'm running 3.8.4 and thereby PHP v. 4.4. Does this mean I can rule out the reference bug you are speaking of?

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Claudia Kosny

Wednesday 11 October 2006 12:32:30 am

Hello Eirik

I would also check the memory usage - I once had a script that exceeded the allowed memory limit always at the 91st product. Although this should produce some error message at least...

Most likely unneccessary question: Did you check the php error log as well? Is your error reporting set to 2047?

Greetings from Luxembourg

Claudia

Eirik Alfstad Johansen

Wednesday 11 October 2006 2:29:35 am

Hi Claudia,

Thanks for the tip. I tried increasing the PHP memory limit from 16MB to 32MB, but it doesn't seem to have had any effect.

Also, the only thing outputted to the error log is this:

[error] PHP Notice: Undefined variable: relMemory in /home/user/public_html/ezpublish-3.8.4/lib/ezutils/classes/ezdebug.php on line 1447

However, this does not terminate the script. It continues to run for about 2 minutes after this message is written to the log.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Xavier Dutoit

Wednesday 11 October 2006 6:11:08 am

Hi Eirik,

I'll second the suggestion to run the import from a cronjob or the cli.

Good luck

X+

http://www.sydesy.com

Eirik Alfstad Johansen

Wednesday 11 October 2006 7:25:58 am

Hi Xavier,

I'm not familiar with running a script as cli. Does it involve refactoring, or do I is there some special shell syntax?

I can't find any documentation regarding it.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Xavier Dutoit

Wednesday 11 October 2006 9:24:30 am

Hi,

Have a look at the bin/php programs. Basically, you have a few init lines:

include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );

$cli =& eZCLI::instance();
$script =& eZScript::instance( array( 'description' => ( "eZ publish Cache Handler\n" .
                                                         "Allows for easy clearing of Cache files\n" .
                                                         "\n" .
                                                         "./bin/ezcache.php --clear-tag=content" ),
                                      'use-session' => false,
                                      'use-modules' => false,
                                      'use-extensions' => true ) );

$script->startup();
...

and the libraries provide various methods to debug, get the params from the cli and so on. Have a look at the existing programs, the opensource the doc is the code ;)

X+

http://www.sydesy.com

Kristian Hole

Wednesday 11 October 2006 10:05:31 am

No, if you are using PHP 4.4, it is probably not caused by the reference bug.

The following error:

[error] PHP Notice: Undefined variable: relMemory

Is given after the code has crashed (from the cleanup-handler in eZ publish), so check if you have errors before this.

I like cronjobs because you do not need all of the startup-code you do in the CLI scripts.

Example of cronjob in extension:

extension/myext/settings/cronjob.ini.append

[CronjobPart-test]
Scripts[]
Scripts[]=test.php

[CronjobSettings]
ExtensionDirectories[]=myext

extension/myext/cronjobs/test.php

<?php
echo "This is my cronjob
?>

Enable the extension.

Then you can run it like this from the ezpublish root dir:

php runcronjobs.php test

http://ez.no/products/ez_publish/documentation/installation/the_cronjob_script

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute