Hi,

let me clarify the situation somewhat. The problem is not intermittent
in the sense that it occurs randomly. It depends mainly on the size of
the answer that riak sends. If the answer is bigger than the network MTU
the error will occur most of the time. If its smaller it occurs almost
never. The recv operation on the socket will usually return after every
received network packet, which means if you call recv fast enough it
will never return more bytes than the MTU of the conection.

For get operations and put operations where return_body is True (the
default) this obviously depends on the size of the object one is
requesting/putting. So it seems to be itermittent if most objects are
smaller than about 1400 bytes (most LANs have an MTU of 1492), but some
are larger or multiple versions are returned for some of them.

The fix I proposed in the bug report (removing the three line) is the
correct one. The while loop only terminates if the desired number of
bytes have been read or a socket error like a timeout or a closed
connection produces an exception.

BTW, I have also observed short write errors when storing large objects
(larger than the default TCP send buffer I would guess, which is 16k at
least on Linux). The fix would be to also loop in snd_pkt() until all
data has been sent.

Cheers,
Nico


Am Freitag, den 21.01.2011, 14:43 -0800 schrieb Bob Feldbauer:
> Interesting. I was actually seeing this all the time, not just 
> intermittently. Removing the lines as described in bug #695 
> (https://issues.basho.com/show_bug.cgi?id=695) did resolve my issue. 
> Thanks for the help, Gary.
> 
> - Bob
> 
> On 1/21/2011 2:28 PM, Gary Flake wrote:
> > I had the same problem the other day and someone answered with the
> > fix.  So search the archives on my name to find the precise answer.
> > But the fix was to remove the three lines in pbc.py where the check
> > and error message occur.   Basically this is a known issue and the
> > check should not be there.
> >
> > -- GWF
> >
> > (sent from my cell phone.)
> >
> >
> >
> > On Jan 21, 2011, at 1:48 PM, Bob Feldbauer<[email protected]>  wrote:
> >
> >> Thanks for the suggestion, Jon. This is occurring every time I try to do 
> >> .store() via protobuf transport in the Python client (so yes, it is 
> >> reproducible); however, there is no output in logs or riak console.
> >>
> >> - Bob
> >>
> >> On 1/21/2011 1:02 PM, Jon Meredith wrote:
> >>> Hi Bob,
> >>>
> >>> That sounds like the connection got closed as the client was readying.
> >>>
> >>> Have you checked through the server logs to verify that no processes died 
> >>> or no other nodes went down?  Or if it's reproducible you should be able 
> >>> to start the server with 'riak console' and see what gets printed.
> >>>
> >>> Cheers, Jon.
> >>> Basho Technologies
> >>>
> >>>
> >>> On Fri, Jan 21, 2011 at 11:36 AM, Bob 
> >>> Feldbauer<[email protected]<mailto:[email protected]>>  wrote:
> >>>
> >>>     I'm using the riak-python-client with Riak 0.14. If I use HTTP
> >>>     instead of PBC, my code works fine; however, with PBC I get a
> >>>     "socket returned short read" error. Any help would be appreciated!
> >>>     Code as follows (for debugging, I added .is_alive() which returns
> >>>     as expected, prior to the error being displayed):
> >>>
> >>>     client = riak.RiakClient(host='servername', port=8087,
> >>>     transport_class=riak.RiakPbcTransport)
> >>>     riakBucket = client.bucket('bucketname')
> >>>     print client.is_alive()
> >>>     ... [code to setup the key/data] ...
> >>>     doc = riakBucket.new(key, data=result)
> >>>     doc.store()
> >>>
> >>>     And the full error shown:
> >>>
> >>>     Traceback (most recent call last):
> >>>      File "riak_import-pb.py", line 23, in<module>
> >>>        doc.store()
> >>>      File
> >>>     "/usr/local/lib/python2.6/dist-packages/riak/riak_object.py", line
> >>>     269, in store
> >>>        Result = t.put(self, w, dw, return_body)
> >>>      File
> >>>     "/usr/local/lib/python2.6/dist-packages/riak/transports/pbc.py",
> >>>     line 190, in put
> >>>        msg_code, resp = self.recv_msg()
> >>>      File
> >>>     "/usr/local/lib/python2.6/dist-packages/riak/transports/pbc.py",
> >>>     line 349, in recv_msg
> >>>        self.recv_pkt()
> >>>      File
> >>>     "/usr/local/lib/python2.6/dist-packages/riak/transports/pbc.py",
> >>>     line 399, in recv_pkt
> >>>        format(len(recv_buf), want_len))
> >>>     riak.RiakError: 'Socket returned short read 1444 - expected 8192'
> >>>
> >>>
> >>>     - Bob Feldbauer
> >>>
> >>>     _______________________________________________
> >>>     riak-users mailing list
> >>>     [email protected]<mailto:[email protected]>
> >>>     http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> >>>
> >>>
> >>
> >> _______________________________________________
> >> riak-users mailing list
> >> [email protected]
> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> 
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to