[
https://issues.apache.org/jira/browse/THRIFT-4591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533643#comment-16533643
]
James E. King III commented on THRIFT-4591:
-------------------------------------------
I modified the C++ framed transport to write size, flush, usleep(25), write
payload, flush. I was unable to get the C++ server running non-blocking mode
to fail the same way that you have documented. The TestClient writes binary
fields from size 0 to 128KB as well as a bunch of other things. So I don't
know what's causing your original issue. Given your change seems to be similar
to how python does it, I'll reopen and merge your change. Please note however
that is is perfectly acceptable to write 4 bytes, flush the socket (thus
producing a TCP/IP packet with a 4 byte payload) and then write the message and
flush. The socket is a stream and it should not matter how it gets placed on
the wire, only that it arrives in order of being sent.
> Incompatibility using non-blocking server and frame transport on C++ side?
> --------------------------------------------------------------------------
>
> Key: THRIFT-4591
> URL: https://issues.apache.org/jira/browse/THRIFT-4591
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.11.0
> Reporter: allen_lee
> Assignee: James E. King III
> Priority: Blocker
> Attachments: 9090.pcap, 9090_1.pcap
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> 1) realize thrift server with TNonblockingServer via c++;
> 2) realize thrift client via lua lib and choose frame transport.
> 3) call remote interface failed with "TTransportException:0: Default
> (unknown)" print, and the server show "TConnection::workSocket():
> THRIFT_EAGAIN (unavailable resources)" error.
> 4)investigate this fault with tcpdump tool, attachment 9090.pcap show the
> frame msg doesnot contains frame size field, the rifht situation of
> attachment 9090_1.pcap show the frame msg contains 4 bytes (00 00 00 25)
> before protocol id field.
> 5) dig into the fault and tried to find root cause, then i found there is an
> fault in TFramedTransport:flush function in TFramedTransport.lua file. the
> original realization is:
> -----
> function TFramedTransport:flush()
> if self.doWrite == false then
> return self.trans:flush()
> end
> -- If the write fails we still want wBuf to be clear
> local tmp = self.wBuf
> self.wBuf = ''
> local frame_len_buf = libluabpack.bpack("i", string.len(tmp))
> self.trans:write(frame_len_buf)
> self.trans:write(tmp)
> self.trans:flush()
> end
> -----
> which send frame size file and reset msg content independently.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)