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

eZ debug

Timing: Jan 18 2025 22:30:48
Script start
Timing: Jan 18 2025 22:30:48
Module start 'content'
Timing: Jan 18 2025 22:30:48
Module end 'content'
Timing: Jan 18 2025 22:30:48
Script end

Main resources:

Total runtime0.1992 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 588.9609180.8125
Module start 'content' 0.00780.0071 769.7734105.9609
Module end 'content' 0.01480.1843 875.7344534.6250
Script end 0.1991  1,410.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00472.3416200.0002
Check MTime0.00160.8172200.0001
Mysql Total
Database connection0.00080.400110.0008
Mysqli_queries0.140270.36791410.0010
Looping result0.00170.87451390.0000
Template Total0.183792.210.1837
Template load0.00080.423710.0008
Template processing0.182891.765710.1828
Override
Cache load0.00060.295110.0006
Sytem overhead
Fetch class attribute can translate value0.00080.409110.0008
XML
Image XML parsing0.00060.307110.0006
General
dbfile0.00311.5760200.0002
String conversion0.00000.003630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs