A starvation of gearman handle process

Skip to first unread message


May 16, 2010, 4:23:51 AM5/16/10
to gearman
I have a problem with gearman handle process. Sometime it starve and
doing nothing.
I work with gearman from PHP. System configuration: Gentoo Linux,
php-5.2.13, pecl-gearman-0.7.0, gearmand-0.12.
In my scripts main process create workekrs (other php scripts) through
proc_open and create tasks. Main process have sigint handler and when
it starve, event this handler not work.
I have code like this:

Main process:

function gearman_complete ()
print ("completed\n");

function start ()
$this->gearmand->setCompleteCallback (array ($this,
foreach ($url_list as $urlInfo)
$tasks[] = $this->gearmand->addTask ('advance_url', serialize
null, 'sape_advance_url_' . $urlInfo->id);
$this->log_event ("Running tasks...");
if ( ! $this->gearmand->runTasks())
$error = $this->gearmand->error();
$this->finish_process_list ($workersProcessList);
die("Can't run tasks: $error!\n");
$this->log_event ("Tasks completed");

And worker process:

function init ()
$this->worker->addFunction("advance_url", array($this,
null, $this->g_advance_url_timeout);
function g_advance_url ($job)
$this->log_event ("[g_advance_url] called");
$this->running_job = $job;
$workload = $job->workload();
$urlInfo = unserialize ($workload);
if ($urlInfo === null)
$job->sendFail ();
$this->running_job = null;
return false;

$result = $this->shoping_action ($urlInfo, 'advance_url');
$this->running_job = null;
$this->log_event ("[g_advance_url] finished");
return serialize ($result);

So in main process console i have some messages "completed", in
workers logs i have some messages pairs "[g_advance_url] called",
"[g_advance_url] finished" and in main process sigint handler not
work, so I decide that not my script are starved, it's problem in
gearman/gearman settings/PECL interface. Can someone help about this
Reply all
Reply to author
0 new messages