php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69332 lost connection to server during send -> libgearman/connection.cc:903
Submitted: 2015-03-30 12:48 UTC Modified: 2017-01-10 08:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: viking at xakep dot ru Assigned:
Status: Suspended Package: gearman (PECL)
PHP Version: 5.5.23 OS: Linux 3.0.42 #1 x86_64 GNU/Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: viking at xakep dot ru
New email:
PHP Version: OS:

 

 [2015-03-30 12:48 UTC] viking at xakep dot ru
Description:
------------
Error when using pcntl_wait inside handle function

Test script:
---------------
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$client = new GearmanClient;
$client->addServer();
$client->addTaskBackground('handle', 'test');
$client->runTasks();
######################################################
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

function doJob($i){
	if($pid = pcntl_fork()){
		return true;
	}
	if(-1 === $pid){
		throw Exception('Unable to fork process');
	}
	sleep($i);
	file_put_contents('test.log', 'Forked child' . PHP_EOL, FILE_APPEND);
	exit;
}

$worker = new GearmanWorker;
$worker->addServer();
$worker->addFunction('handle', function(GearmanJob $job){
	for($i = 0; $i < 10; ++$i){
		doJob($i, $job->workload());
	}
	$status = null;
	while(0 < ($pid = pcntl_wait($status))){
		file_put_contents('test.log', 'child closed: ' . $pid . '(' . var_export($status) . ')' . PHP_EOL, FILE_APPEND);
	}
	$job->sendComplete('ok');
});
$worker->setTimeout(5000000);
if(!$worker->work()){
	echo 'failed';
}
echo 'done';


Expected result:
----------------
Job complete normaly

Actual result:
--------------
Job fails and returns to queue

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-10 08:25 UTC] kalle@php.net
-Status: Open +Status: Suspended
 [2017-01-10 08:25 UTC] kalle@php.net
The gearman extension have not had much activity in the past few years, so I'm taking the safe bet that this is no longer under active development (as I don't consider the typo fixes on the github repo an active development), besides that it also targets unsupported PHP versions. Please unsuspend this report in case it begins to blossom with life once more
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC