unfortunately we're still running PHP 5.1, so pheanstalk is not an option On Sat, Mar 27, 2010 at 8:51 AM, Peter McArthur <[email protected]> wrote:
> Try pheanstalk, I've had much better luck with it. > http://github.com/pda/pheanstalk/ > > > On Mar 27, 2010, at 11:06 AM, dave wrote: > > > We're using the php beanstalk client: > https://sourceforge.net/projects/beanstalk/ > > and have run into cases where the script will get stuck in an infinite > > loop trying to read data from beanstalkd. beanstalkd appears healthy > > and requires no restart/interaction but the infinite loop causes all > > communication w/beanstalk to cease. In the logs we see the following: > > > > Mar 27 07:25:18 172.16.4.18 BeanStalkWrapper.class.php[26403]: PHP > > Warning: stream_set_blocking(): supplied argument is not a valid > > stream resource in /var/www/virtuals/shared/lib/BeanStalk.class.php on > > line 1076 > > Mar 27 07:25:18 172.16.4.18 BeanStalkWrapper.class.php[26403]: PHP > > Warning: fread(): supplied argument is not a valid stream resource > > in /var/www/virtuals/shared/lib/BeanStalk.class.php on line 1087 > > Mar 27 07:25:18 172.16.4.18 BeanStalkWrapper.class.php[26403]: PHP > > Warning: stream_set_blocking(): supplied argument is not a valid > > stream resource in /var/www/virtuals/shared/lib/BeanStalk.class.php on > > line 1076 > > Mar 27 07:25:18 172.16.4.18 BeanStalkWrapper.class.php[26403]: PHP > > Warning: fread(): supplied argument is not a valid stream resource > > in /var/www/virtuals/shared/lib/BeanStalk.class.php on line 1087 > > > > The function that's raising the warnings is: > > private function read_message($in_buf_size=256, > > $in_operation_timeout=-1) { > > stream_set_blocking($this->socket, 0); > > $in_buf_size += strlen(self::MSG_DELIM); > > $no_packet = true; // Start off trying to hit up the > > buffer > > $to = microtime(true) + $in_operation_timeout; > > do { > > if ($this->rbuflen < self::MAX_READ_BUF || $no_packet) { > > // read new data if we are under the read buffer size > > or > > // if we couldnt find a complete message in the buffer > > last > > // time > > > > $no_packet = false; > > $data = fread($this->socket,$in_buf_size); > > > > if ($data === false) > > return self::READ_ERROR; > > > > if ($tbuflen = strlen($data)) // Got something. > > Put it in the buffer. > > { > > $this->rbuf .= $data; > > $this->rbuflen += $tbuflen; > > } > > } > > > > if ($this->rbuflen && ($pos = strpos($this->rbuf, > > self::MSG_DELIM, 0)) !== false) { > > // Found a packet > > $wanted_packet = substr($this->rbuf,0,$pos); > > $seek = $pos+strlen(self::MSG_DELIM); > > $this->rbuf = substr($this->rbuf,$seek); > > if (strlen($wanted_packet)) { > > $this->rbuflen -= $seek; > > if (BeanStalk::DEBUG) > > echo __METHOD__."({$wanted_packet})\n"; > > > > return $wanted_packet; > > } > > } > > > > $no_packet = true; > > } while ($tbuflen); > > > > return self::READ_ERROR; > > } > > > > Any help would be greatly appreciated. > > > > -- > > You received this message because you are subscribed to the Google Groups > "beanstalk-talk" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]<beanstalk-talk%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/beanstalk-talk?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "beanstalk-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<beanstalk-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/beanstalk-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "beanstalk-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.
