Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Templates recompiled only after two script executions

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Tue Sep 20, 2011 1:48 pm    Post subject: Templates recompiled only after two script executions Reply with quote

When I make changes to smarty template, these changes are seen only after the second script execution. Smarty 3.1 from SVN, compile_check = true.
Back to top
View user's profile Send private message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Sun Oct 02, 2011 5:34 pm    Post subject: Reply with quote

any comments?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sun Oct 02, 2011 6:18 pm    Post subject: Reply with quote

Is there a delay somewhere on your system, such as a short NFS cache? Reverse proxy cache? Smarty should recompile right away, there is nothing to make it wait for a second execution.
Back to top
View user's profile Send private message Visit poster's website
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Mon Oct 03, 2011 4:36 am    Post subject: Reply with quote

Yes, there is eAccelerator.

When eAccelerator is off, the template is recompiled immediately after I change it, i.e. I see modifications in the browser after the first script execution.

When eAccelerator is on, after editing template:
1. at first execution the template is recompiled (the size of compiled template changes), but I don't see modifications in the browser.
2. at second execution I see modifications in the browser (now, the size of compiled template does not changes).
So, at first script execution the template is recompiled ok, but somehow the old version of compiled template is executed.

The code to test this is very simple, but you also need eAccelerator:
Code:

include_once dirname(__FILE__) . "/smarty/Smarty.class.php";
$smarty = new Smarty;
$smarty-> compile_dir = dirname(__FILE__) . "/compiled";
$smarty->template_dir = dirname(__FILE__) . "/templates";
echo $smarty->fetch('test.html');



eAccelerator dll 5.2.14 TS
Code:

     zend_extension_ts             = "C:\Program Files\PHP\ext\eAccelerator.dll"
     eaccelerator.cache_dir        = "D:\EACCELERATOR"
     eaccelerator.log_file         = "D:\EACCELERATOR\eAccelerator.log"
     eaccelerator.keys             = "shm_and_disk"
     eaccelerator.content          = "shm_and_disk"
     eaccelerator.sessions         = "shm_and_disk"
     eaccelerator.filter           = ""
     eaccelerator.name_space       = ""
     eaccelerator.debug            = "0"
     eaccelerator.enable           = "1"
     eaccelerator.optimizer        = "1"
     eaccelerator.check_mtime      = "1"
     eaccelerator.compress         = "0"
     eaccelerator.compress_level   = "9"
     eaccelerator.shm_max          = "0"
     eaccelerator.shm_ttl          = "0"
     eaccelerator.shm_only         = "0"
     eaccelerator.shm_size         = "0"
     eaccelerator.shm_prune_period = "0"
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Oct 03, 2011 1:59 pm    Post subject: Reply with quote

That is strange, if the template gets recompiled then it should show you the newly compiled output. Are you the only thread hitting the web server? Maybe another thread is creating the recompile, and what you are seeing is a cache delay of eAccelerator. It is certainly eAccelerator behavior, and not Smarty.

If all else fails, leave eAccelerator disabled during development. Or use APC, I've never seen this behavior with it.
Back to top
View user's profile Send private message Visit poster's website
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Tue Oct 04, 2011 8:01 am    Post subject: Reply with quote

Code:
Are you the only thread hitting the web server?

The server is on my local PC, so I don't think that there can be concurrent threads.

Code:
If all else fails, leave eAccelerator disabled during development.

Thx. Already done so Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP