PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_Server » Bug #9083

multiprocess not working

Details

Submitted2006-10-18 21:41 UTC
Frompear at synace dot com
StatusNo Feedback
PackageNet_Server
PHP Version5.1.6
Roadmaps(Not assigned)

Comments

[2006-10-18 21:41 UTC] pear at synace dot com

Description:
------------
patch below

Test script:
---------------
22c22,23
< class Net_Server_Multiprocess extends Net_Server_Driver {
---
> class Net_Server_Driver_Multiprocess extends Net_Server_Driver {
> var $_name = 'multiprocess';
33a35,45
> * set the unique process name
> *
> * @access public
> * @param int $name
> */
> function setName($name)
> {
> $this->_name = $name;
> }
>
> /**
138c150
< $this->_threadPool[$i] = & new Net_Server_Thread_Processor($i, $this);
---
> $this->_threadPool[$i] = & new Net_Server_Driver_Multiprocess_Processor ($i, $this);
144c156
< $this->_mpmObj = & new MPM($this->_threadPool, $this);
---
> $this->_mpmObj = & new Net_Server_Driver_Multiprocess_MPM($this->_threadPool, $this);
150,152c162,163
< $consoleClassName = $this->_console;
< if (!@include_once ('Net/Server/Driver/Multiprocess/'.$consoleClassName.'.php')) {
< die ('Unknown console ' . $consoleClassName);
---
> if (!@include_once ('Net/Server/Driver/Multiprocess/'.$this->_console.'.php')) {
> die ('Unknown console ' . $this->_console);
154c165,166
< $this->_consoleObj = & new $consoleClassName($this);
---
> $consoleClassName = 'Net_Server_Driver_Multiprocess_'.$this->_console;
> $this->_consoleObj = & new $consoleClassName($this, '');
277,288c289,304
< if (method_exists($this->callbackObj, "onShutdown")) {
< $this->callbackObj->onShutdown();
< }
< // this always should return true, we use PHP_FORK_RETURN_METHOD because
< // we want to wait until all processes are really stopped...
< if ($this->_mpmObj->stopAllProcesses(array(''), PHP_FORK_RETURN_METHOD)) {
< print "Stopping " . $this->_mpmObj->getName() . "\n";
< $this->_mpmObj->stop();
<
< print "Exiting from console...\n";
< } else {
< print "Error stopping mpm\n";
---
> if ($this->_mpmObj && $this->_consoleObj) {
> if (method_exists($this->callbackObj, "onShutdown")) {
> $this->callbackObj->onShutdown();
> }
> // this always should return true, we use PHP_FORK_RETURN_METHOD because
> // we want to wait until all processes are really stopped...
> if ($this->_mpmObj->stopAllProcesses(array(''), PHP_FORK_RETURN_METHOD)) {
> print "Stopping " . $this->_mpmObj->getName() . "\n";
> $this->_mpmObj->stop();
>
> print "Exiting from console...\n";
> } else {
> print "Error stopping mpm\n";
> }
> $this->closeConnection();
> $this->_consoleObj->stop();
290,291d305
< $this->closeConnection();
< $this->_consoleObj->stop();

[2006-10-18 22:05 UTC] pear at synace dot com

note that this still doesn't work entirely.. just getting there.. doesn't keep the MPM up unless pear constructor is disabled... dunno why.

doesn't properly shutdown..

i'm using fork in the meantime