Ticket #107 (new defect)

Opened 2 years ago

Last modified 2 years ago

eA "vs" ZendFramework: hangs when php.ini(session.save_hanlder = eaccelerator)

Reported by: openmacnews Assigned to: bart
Priority: minor Milestone: 0.9.6
Component: eAccelerator Version: 0.9.5
Keywords: zend framework Cc:

Description

hi all,

this is an ea-only-when-using-zend-framework issue ... but Bart points out that eA should be 'transparent'.

so posting this issue here.  fyi, it's also posted as Ticket#117 @ zend trac (http://framework.zend.com/developer/ticket/117) ...

i've eA installed with ZendFramework (ZF) r566 installed on OSX 10.4.6 w/:

	Apache/2.2.3-dev + APR 1.2.8-dev + APR-Util 1.2.8-dev (r410377)
		32-bit, mpm=worker, threaded, forked
	PHP Version => 5.2.0-dev
		configure ... --with-tsrm-pthreads --enable-maintainer-zts ...
		Debug Build => no
		Thread Safety => enabled
	eAccelerator v0.9.5-beta2 (r212)
	php.ini
		...
		session.save_handler = files
		zend_extension_ts="/usr/local/php_libs/ext/no-debug-zts/eaccelerator.so"
		eaccelerator.enable="1"
		eaccelerator.optimizer="1"
		eaccelerator.sessions="shm"
		...

and per prior discuss on ZF list, my vhost config is:

	<VirtualHost zend.mydomain.com:80>
		ServerName     zend.mydomain.com
		ServerRoot     /webapps/
		DocumentRoot   /webapps/zend.mydomain.com/document_root

		RewriteEngine off

		<Location / >
			RewriteEngine on
			RewriteCond %{REQUEST_FILENAME} !-f
			RewriteCond %{REQUEST_FILENAME} !-d
			RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

			Options FollowSymLinks Includes ExecCGI MultiViews
		</Location>

	RewriteLogLevel 9
	RewriteLog      /var/log/modrewrite.log

	</VirtualHost>


with the above config, all's well.

if, however i:

	---	session.save_handler = files
	+++	session.save_handler = eaccelerator

all non-ZF-controller'd sites work perfectly, with eA as the session
save_handler.

but, the ZF site now pegs CPU to 100%, paints NO output, and eventually
kills off the Apache thread with a BusError:

apache log:
	[Mon Jun 05 09:57:20 2006] [notice] child pid 24933 exit signal Bus
error (10)


the only other log activity i have at the moment is in modrewrite debug log.

modrewrite.log, w/ "session.save_handler = eaccelerator":
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c2450/initial] (3) [perdir /]
strip per-dir prefix: /webapps/zend.mydomain.com/document_root/ ->
webapps/zend.mydomain.com/document_root/
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c2450/initial] (3) [perdir /]
applying pattern '\.(js|ico|gif|jpg|png|css)$' to uri
'webapps/zend.mydomain.com/document_root/'
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c2450/initial] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/'
pattern='!-f' => matched
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c2450/initial] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/'
pattern='!-d' => not-matched
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c2450/initial] (1) [perdir /] pass
through /webapps/zend.mydomain.com/document_root/
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c8450/subreq] (3) [perdir /] strip
per-dir prefix: /webapps/zend.mydomain.com/document_root/index.php ->
webapps/zend.mydomain.com/document_root/index.php
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c8450/subreq] (3) [perdir /]
applying pattern '\.(js|ico|gif|jpg|png|css)$' to uri
'webapps/zend.mydomain.com/document_root/index.php'
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c8450/subreq] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/index.php'
pattern='!-f' => not-matched
10.0.0.6 - - [05/Jun/2006:09:56:57 --0700]
[zend.mydomain.com/sid#191d6b8][rid#19c8450/subreq] (1) [perdir /] pass
through /webapps/zend.mydomain.com/document_root/index.php



modrewrite.log, w/ "session.save_handler = files":
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c3050/initial] (3) [perdir /]
strip per-dir prefix: /webapps/zend.mydomain.com/document_root/ ->
webapps/zend.mydomain.com/document_root/
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c3050/initial] (3) [perdir /]
applying pattern '\.(js|ico|gif|jpg|png|css)$' to uri
'webapps/zend.mydomain.com/document_root/'
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c3050/initial] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/'
pattern='!-f' => matched
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c3050/initial] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/'
pattern='!-d' => not-matched
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c3050/initial] (1) [perdir /] pass
through /webapps/zend.mydomain.com/document_root/
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c9050/subreq] (3) [perdir /] strip
per-dir prefix: /webapps/zend.mydomain.com/document_root/index.php ->
webapps/zend.mydomain.com/document_root/index.php
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c9050/subreq] (3) [perdir /]
applying pattern '\.(js|ico|gif|jpg|png|css)$' to uri
'webapps/zend.mydomain.com/document_root/index.php'
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c9050/subreq] (4) [perdir /]
RewriteCond: input='/webapps/zend.mydomain.com/document_root/index.php'
pattern='!-f' => not-matched
10.0.0.6 - - [05/Jun/2006:10:17:04 --0700]
[zend.mydomain.com/sid#18b5eb8][rid#19c9050/subreq] (1) [perdir /] pass
through /webapps/zend.mydomain.com/document_root/index.php


to my eye, there's no difference here ...

again, the only scenario that 'fails' is a ZF site w/
session.save_handler = eaccelerator.


richard

Change History

06/12/06 19:39:56 changed by openmacnews

  • keywords set to zend framework.
  • owner changed from somebody to bart.
  • priority changed from major to critical.
  • milestone set to 0.9.6.

hi bart,

fyi, there's a first bit of feedback @ Zend Framework list:

http://www.zend.com/lists/fw-general/200606/msg00326.html

suspecting something "odd" happening with eA.

07/18/06 16:44:04 changed by openmacnews

  • priority changed from critical to blocker.
  • milestone changed from 0.9.6 to 0.9.5.

any news/progress on this?

any interest in addressing it?

at this stage, any sites that use zend's framework simply have to have eA removed ...

07/19/06 09:38:48 changed by bart

But it's only when using the eaccelerator session handler? It's broken, you need to serialize object your self before putting them in eA.

07/19/06 09:48:15 changed by bart

  • priority changed from blocker to minor.

07/22/06 13:04:51 changed by bart

I installed ZF and tried running some demos and unittests and I didn't run in any problem. I also enabled the eA session handler and that didn't change the results either. Could you provide me with a script using the ZF that reproduces these errors?

07/27/06 17:12:05 changed by openmacnews

per request, here's a simple (relatively, in zend-framework-land ...) scenario that reproduces the error as reported.

w/

php -i:
======================================================================
PHP Version => 5.2.0-dev
...
System => Darwin dev 8.7.0 Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC Power Macintosh
Build Date => Jul 10 2006 06:31:18
...
Configuration File (php.ini) Path => /var/Conf/PHP5/php.ini
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => enabled
Zend Memory Manager => enabled
...
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
 with eAccelerator v0.9.5-rc1, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
...
======================================================================

httpd -V:
======================================================================
Server version: Apache/2.2.3-dev
Server built:   Jul 18 2006 12:30:52
Server's Module Magic Number: 20051115:2
Server loaded:  APR 1.2.8-dev, APR-Util 1.2.8-dev
Compiled using: APR 1.2.8-dev, APR-Util 1.2.8-dev
Architecture:   32-bit
Server MPM:     Worker
  threaded:     yes (fixed thread count)
	forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/worker"
...
======================================================================

svn info /webapps/tools/zend_framework:
======================================================================
Path: .
URL: http://framework.zend.com/svn/framework/trunk
Repository Root: http://framework.zend.com/svn/framework
Repository UUID: 44c647ce-9c0f-0410-b52a-842ac1e357ba
Revision: 923
Node Kind: directory
Schedule: normal
Last Changed Author: stefan
Last Changed Rev: 923
Last Changed Date: 2006-07-24 12:04:31 -0700 (Mon, 24 Jul 2006)
======================================================================

and,

php.ini:
======================================================================
...
;##########
[eaccelerator]
zend_extension_ts="/usr/local/php_libs/extensions/no-debug-zts-20060613/eaccelerator.so"

eaccelerator.enable="0"
eaccelerator.optimizer="1"
eaccelerator.debug="1"

eaccelerator.cache_dir="/webapps/sites/tmp/eaccelerator"
eaccelerator.log_file="/var/Logs/eaccelerator.log"

eaccelerator.shm_size="64"
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"

eaccelerator.check_mtime="1"
eaccelerator.filter="!*/symfony_sites/*/config/*  !*/symfony_sites/*/lib/symfony/*"


eaccelerator.compress="1"
eaccelerator.compress_level="5"
eaccelerator.allowed_admin_path="/wevapps/sites/admin/"
eaccelerator.keys="shm_and_disk"
eaccelerator.sessions="shm_and_disk"
eaccelerator.content="shm_and_disk"
...
======================================================================


a webapp/site buit with/as:

/webapps/sites/zend.mydomain.com/document_root/index.php:
======================================================================
<?php

session_start();

$tools_root  = '/webapps/tools';
$site_root   = '/webapps/sites/zend.mydomain.com';

ini_set('include_path',
	        $site_root
	. ":" . $site_root . '/classes'
	. ":" . $site_root . '/views'
	. ":" . $tools_root . '/zend_framework/library'
	. ":" . $tools_root . '/zend_framework/incubator/library'
	. ":" . $tools_root . '/zend_proposals/library'
	. ":" . ini_get('include_path')
);

function __autoload($class) {
	Zend::loadClass($class);
}

require_once('Zend.php');   // ZendFramework

// instantiate & register site-wide Config objects
// include('Zend/Config.php');
$target = $site_root.'/resources/configs/siteEnv.ini';

$siteConfig = new Zend_Config(Zend_Config_Ini::load($target, 'site'));
$zfConfig   = new Zend_Config(Zend_Config_Ini::load($target, 'zf'));

Zend::register('siteConfig', $siteConfig);
Zend::register('zfConfig', $zfConfig);

// instantiate view object
$view = new Zend_View();
$view->setScriptPath($zfConfig->view_dir);
Zend::register('view', $view);

// pass to FrontController
Zend::loadClass('Zend_Controller_Front');
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($zfConfig->controller_dir);
$controller->dispatch();

?>
======================================================================


/webapps/sites/zend.mydomain.com/controllers/IntroController.php
======================================================================
<?php

class IntroController extends Zend_Controller_Action 
{

	public function __construct()
	{
		$zfConfig = Zend::registry('zfConfig');
		$this->_model_dir = $zfConfig->model_dir;
		$this->_section = 'frontpage';
	}

	public function indexAction()
	{
		$this->_redirect('/');
	}

	public function welcomeAction()
	{
		$this->_subsection = 'welcome';
		$this->_displayPage();
	}

	public function noRouteAction()
	{
		$this->_redirect('/');
	}

	public function __call($action, $arguments)
	{
		$this->_redirect('/');
	}

	protected function _displayPage()
	{
		$this->_loadSubsectionTemplate();
	}

	protected function _loadSubsectionTemplate()
	{
		$view = Zend::registry('view');
		$view->section = $this->_section;
		$view->subsection = $this->_subsection;
		echo $view->render($this->_section.'.tpl');
	}

}
?>
======================================================================

and,

/webapps/sites/zend.mydomain.com/views/frontpage.tpl:
======================================================================
<?php
include('document/doctype_header.tpl');
include('document/meta_tags.tpl');
?>

<title>Welcome</title>

<style type="text/css" media="all">
	@import "/css/base.css";
</style>

<?php
echo '<style type="text/css" media="all">';
echo 
	'@import "/css/'.
		$this->section.'/'.
		$this->section.'.css";'
	."\n".
	
	'@import "/css/'.
	$this->section.'/'.
	$this->subsection.'/'.
	$this->subsection.'.css";'
	."\n".
'</style>'
;
?>

<body>

	TEST

</body>
</html>

?>
======================================================================

then, nav to:

	http://www.mydomain.com/intro/welcome

displays in browser:

	TEST

and the rest of the non-eA'd site works perfectly.


if, however, i ENABLE eA:

php.ini:
======================================================================
...
---	eaccelerator.enable="0"
+++	eaccelerator.enable="1"
...
======================================================================

then, nav to:

	http://www.mydomain.com/intro/welcome

fails, resulting in a ~30-sec time lag, then display of a BLANK browser page, and, in logs ...

eaccelerator.log:
======================================================================
[1046] EACCELERATOR hit: "/webapps/sites/zend.mydomain.com/document_root/index.php"
[1046] EACCELERATOR hit: "/webapps/tools/zend_framework/library/Zend.php"
[1046] EACCELERATOR hit: "/webapps/tools/zend_framework/library/Zend/Exception.php"
[1046] EACCELERATOR hit: "/webapps/tools/zend_framework/library/Zend/Config.php"
[1046] EACCELERATOR hit: "/webapps/tools/zend_framework/library/Zend/Config/Exception.php"
[1046] EACCELERATOR hit: "/webapps/tools/zend_framework/library/Zend/Config/Ini.php"
======================================================================


apache2_error.log:
======================================================================
[Thu Jul 27 06:29:49 2006] [notice] SIGHUP received.  Attempting to restart
[Thu Jul 27 06:29:49 2006] [notice] Apache/2.2.3-dev (Unix) DAV/2 PHP/5.2.0-dev SVN/1.3.3-dev mod_perl/2.0.3-dev Perl/v5.8.8 configured -- resuming normal operations
[Thu Jul 27 06:29:49 2006] [info] Server built: Jul 18 2006 12:30:52
[Thu Jul 27 06:29:49 2006] [debug] worker.c(1715): AcceptMutex: sysvsem (default: sysvsem)
[Thu Jul 27 06:30:13 2006] [notice] child pid 1044 exit signal Segmentation fault (11)
======================================================================


this is 100% reproducible on several boxes, admittedly similarly configured.

a similarly-architected site in CakePHP framework w/ eA enabled is without problem.

a similarly-architected site in Symfony framework w/ eA enabled shows different, problematic behavior, but with:
  eaccelerator.filter="!*/symfony_sites/*/config/*  !*/symfony_sites/*/lib/symfony/*"
seems to 'cure' ...

07/30/06 18:08:56 changed by openmacnews

with latest branch (r259), this is still an issue for both zend & symfony sites.

note, per latest fixes of 5.2-compatibility, for symfony:

--- eaccelerator.filter="!*/symfony_sites/*/config/* !*/symfony_sites/*/lib/symfony/*" +++ eaccelerator.filter=""

richard

08/03/06 12:51:22 changed by bart

  • milestone changed from 0.9.5 to 0.9.6.

This tests are done with the current trunk and php 5.2!