Gearman client doBackground always returns GEARMAN_TIMEOUT
        Posted  
        
            by 
                Ascherer
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ascherer
        
        
        
        Published on 2012-10-15T22:56:55Z
        Indexed on 
            2012/10/15
            23:01 UTC
        
        
        Read the original article
        Hit count: 252
        
So, ive got a simple gearman system running right now, with a worker running.
The worker basically just takes the payload (a random number in this case, and is supposed to echo it back to the screen. Literally an echo, not returning to the client. 
The client sends the random number. Im trying to do a $client->doBackground( 'post', 65482, md5(uniqid())); but its coming back with a 47 error (GEARMAN_TIMEOUT) every time.
getErrNo() returns 0, error() returns something about GEARMAN_TIMEOUT
However, when i change it to just $client->do(blah, blah, blah), it works just fine.
I've even occasionally seen it where the worker still echo's the number, even after getting the timeout error...
public function execute()
    {
        $method = 'do';
        if( !$this->getBlock() )
        {
            $method .= ( $this->getPriority() == 'Normal' ? '' : $this->getPriority() ) . 'Background';
        }
        else
        {
            $method .= $this->getPriority();
        }
        echo "Method: $method \t Worker: {$this->getName()} \t Payload: {$this->getPayload()} \t Hash: {$this->getHash()}\n";
        $this->setResult(
            $this->getClient()
                ->$method(
                    $this->getName(),
                    $this->getPayload(),
                    $this->getHash()
                )
        );
        if( $this->getClient()->returnCode() != GEARMAN_SUCCESS )
        {
            echo "Code: " . $this->getClient()->returnCode() . "\t" . GEARMAN_TIMEOUT . "\n";
        }
    }
        © Stack Overflow or respective owner