php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59848 Server-side callbacks not working for background tasks
Submitted: 2011-07-13 12:10 UTC Modified: 2011-07-14 00:03 UTC
From: dev at bottomlessinc dot com Assigned: hradtke
Status: Wont fix Package: gearman (PECL)
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-07-13 12:10 UTC] dev at bottomlessinc dot com
Description:
------------
Client doesn't receive data/status from workers when jobs 
are run in 
the background.

This was already mentioned by Rasmus back in 2009:
http://toys.lerdorf.com/archives/51-Playing-with-
Gearman.html

quote:
"I only use non-blocking background tasks and it currently 
isn't 
possible to use this data passing mechanism from a 
background task. 
Right now if you call $job->data() from a background worker, 
the 
data is simply dropped."

(see the 2 last paragraphs)

What's the status?

Is the problem with the Gearman server? or only the Pecl 
extensions?

Reproduce code:
---------------
On the client:

Register callbacks:
setDataCallback()
setStatusCallBack()

Add bg tasks:
addTaskBackground()
runTasks()

On the Worker:
sendData()
sendStatus()

Expected result:
----------------
When the worker calls sendData/sendStatus, the corresponding 
registered callbacks on the Client should be called

Actual result:
--------------
Callbacks not called, data dropped.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-14 00:03 UTC] hradtke@php.net
Once a client sends a background task, the client is no longer registered as listening on the gearman daemon. When the worker sends the data back, it goes to the daemon, the daemon concludes no one is listening and drops the data.

When PHP makes an asynchronous request, it fires and forgets. It does not work like JavaScript.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 21:01:55 2014 UTC