This bug was fixed in thrift php trunk

2011/3/30 William Oberman <ober...@civicscience.com>

> I think I found a bug in the cassandra PHP client.  I'm using phpcassa, but
> the bug is in thrift itself, which I think that library phpcassa just
> wraps.  In any case, I was trying to test on my local machine, which has
> limited RAM, so I reduced the JVM heap size.  Of course I immediately had an
> OOM causing my local cassandra server to crash, but that caused my unit
> tests to stall at 100% CPU, which seemed weird to me.  I had to figure out
> why.  It seems that TSocket doesn't test for EOF (it's only checking for a
> socket timeout), causing a tight infinite loop when the connection
> disappears.  Checking for EOF in an else if seems like an easy fix, but
> given how deep this code is in the library I'll leave it to the experts.
>
> My diff of the file:
> @@ -255,6 +255,9 @@
>          if (true === $md['timed_out'] && false === $md['blocked']) {
>            throw new TTransportException('TSocket: timed out reading
> '.$len.' bytes from '.
>                                 $this->host_.':'.$this->port_);
> +        } else if(feof($this->handle_)) {
> +           throw new TTransportException('TSocket: EOF reading '.$len.'
> bytes from '.
> +                               $this->host_.':'.$this->port_);
>          } else {
>            $pre .= $buf;
>            $len -= $sz;
>
>
> --
> Will Oberman
> Civic Science, Inc.
> 3030 Penn Avenue., First Floor
> Pittsburgh, PA 15201
> (M) 412-480-7835
> (E) ober...@civicscience.com
>

Reply via email to