|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61840 Worker exits with GearmanWorker::work(): flush(Broken pipe) on completion
Submitted: 2012-04-24 15:25 UTC Modified: 2013-02-18 00:35 UTC
From: russ at eatmymonkeydust dot com Assigned: hradtke (profile)
Status: No Feedback Package: gearman (PECL)
PHP Version: 5.3.10 OS: Ubuntu 10.04.4 LTS (Lucid)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: russ at eatmymonkeydust dot com
New email:
PHP Version: OS:


 [2012-04-24 15:25 UTC] russ at eatmymonkeydust dot com
The gearman-developers ppa recently updated gearman to 0.32 which forced us to rebuild pecl/gearman (1.0.2 at the time of this ticket).

Everything builds fine and tasks run but once the task completes the php process exits with the following warning:

PHP Warning:  GearmanWorker::work(): flush(Broken pipe) lost connection to server during send -> libgearman/ in /xxx/forkTask.class.php on line 60

Line 60 is a while($worker->work()) {} statement.

The first task completes, but then subsequent tasks are not "picked up" since the php process running this handler is killed.

Expected result:
No output, just continue the while loop and pick up the next worker

Actual result:
PHP Warning:  GearmanWorker::work(): flush(Broken pipe) lost connection to server during send -> libgearman/ in /xxx/forkTask.class.php on line 60

php process exits


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-25 00:44 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: hradtke
 [2012-04-25 01:43 UTC]
I setup a simple worker that does nothing and a client that sends 5 tasks to the 
worker. I cannot reproduce. Can you please provide a simple worker script that 
causes this?
 [2012-04-25 01:43 UTC]
-Status: Assigned +Status: Feedback
 [2012-12-04 17:34 UTC] crontab at codehaven dot net
I too have this problem.  Code is below.  Note that gearmand is being run on a remote server on the internet that is 12 hops away (31ms ping time).  Appropriate firewall ports are open (otherwise the initial connection would fail, of course).  PECL package gearman, version 1.0.2 stable.  The d() function just echoes a timestamped string to the console.

$gw = new GearmanWorker();
$gw->addServer("", 4730);
$gw->addFunction("myfunc", "myfunc_fn");

while($gw->work()) {
	if ($gw->returnCode() != GEARMAN_SUCCESS) {
		d("Return code: ".$gw->returnCode());
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 27 08:03:36 2021 UTC