diff options
author | Steve Vinoski <[email protected]> | 2010-09-11 01:41:56 -0400 |
---|---|---|
committer | Steve Vinoski <[email protected]> | 2010-09-11 08:29:25 -0400 |
commit | 945bad4712824e534aaa6530304948a4b032f4b0 (patch) | |
tree | 60a3c2b3f80c86396c835531ef5859eb20526028 /INSTALL-CROSS.md | |
parent | f86c89a90a228eed9a58632cc0fb3372b210ec1a (diff) | |
download | otp-945bad4712824e534aaa6530304948a4b032f4b0.tar.gz otp-945bad4712824e534aaa6530304948a4b032f4b0.tar.bz2 otp-945bad4712824e534aaa6530304948a4b032f4b0.zip |
fix incorrect writev iovec buffer handling in ei
For platforms that support writev, ei uses iovec structures to be able
to easily send noncontiguous data buffers. When sending large
messages, the socket can of course block, in which case ei adjusts its
iovecs to pick up where it left off when the socket becomes writeable
again. Unfortunately the code that handled the case when the number of
bytes written are less than the current iovec size adjusted only the
iovec byte count but not the iovec data pointer, resulting in the same
data being sent multiple times.
The fix is trivial: in addition to subtracting the count of bytes
already written from the current iovec's size, also increment the
current iovec's data pointer by the number of bytes already written.
Tested manually on Linux and verified to fix a problem detected in
production with writing large binaries from a cnode to a regular
node. No unit tests were added, however, because they use the local
loopback which acts more like a pipe than an inter-host TCP
connection. The closing of the TCP window on the receiving side and
the resultant write blocking on the socket, which in turn caused the
code that mishandled the iovecs to be exercised, could unfortunately
not be readily duplicated in the erl_interface test suite.
Diffstat (limited to 'INSTALL-CROSS.md')
0 files changed, 0 insertions, 0 deletions