The program at the bottom reproduces the problem: when the number of iovecs to the dma_write function exceeds IOV_MAX, the remaining entries are silently dropped.
The file is expected to contain 8 megabytes of the letter 'A'. It, however, only contains 4
megabytes of it, and then the rest is zeroes on my machine. To confirm, try doing
> head -c 4194304 ./output.file | tail -c -1
A
> head -c 4194305 ./output.file | tail -c -1
<no output>
The reason is that the writev's documentation says that
the number of iovecs shouldn't exceed the IOV_MAX value (which is 1024 on Linux), while we clearly
give more than IOV_MAXiovecs to the dma_write function (that I believe is implemented in
terms of writev).
So, the behavior of the seastar is correct in the sense that it matches the documentation and it's the
program's fault that it violated the limit on iovec entries. But the problem is extra hard to
debug, so maybe it's worth going an extra mile and adding a check (maybe just to a debug version of
seastar if performance seems an issue) to throw an exception here? This will make it way easier for
a developer to spot an error.
The source code for the reproduction of the issue:
The program at the bottom reproduces the problem: when the number of
iovec
s to thedma_write
function exceedsIOV_MAX
, the remaining entries are silently dropped.The file is expected to contain 8 megabytes of the letter 'A'. It, however, only contains 4 megabytes of it, and then the rest is zeroes on my machine. To confirm, try doing
The reason is that the writev's documentation says that the number of
iovec
s shouldn't exceed theIOV_MAX
value (which is 1024 on Linux), while we clearly give more thanIOV_MAX
iovec
s to thedma_write
function (that I believe is implemented in terms ofwritev
).So, the behavior of the
seastar
is correct in the sense that it matches the documentation and it's the program's fault that it violated the limit oniovec
entries. But the problem is extra hard to debug, so maybe it's worth going an extra mile and adding a check (maybe just to a debug version of seastar if performance seems an issue) to throw an exception here? This will make it way easier for a developer to spot an error.The source code for the reproduction of the issue: