[Interest] TCP window scale

Thiago Macieira thiago.macieira at intel.com
Tue May 23 22:08:44 CEST 2023


On Tuesday, 23 May 2023 12:28:43 PDT Yauheni Pervenenka via Interest wrote:
>     const auto writeToSocket = [&](){
>         const auto written = tcpSocket.write(QByteArray(8192, '1'));
>         qDebug() << "Sending " << written << " bytes";
>     };

>     QObject::connect(&tcpSocket, &QIODevice::bytesWritten,
>                      &tcpSocket, [&](auto bytes){
>         qDebug() << "Bytes written = " << bytes;
>         writeToSocket();
>     });

This could cause unconstrained memory growth, because you're adding 8kB of 
data every time that any amount of data gets written. The MTU in the localhost 
interface is greater than 8 kB, so this won't be a problem in this test, but 
if you tried this over Ethernet, with an MTU of 1500, it's possible that 
bytesWritten() would get emitted after 1460 bytes get written.

So you'd have:
 - connected
...after a while...
 - write 8 kB → buffer is 8 kB
 - bytesWritten(1460) → buffer is 6732 bytes
 - write 8 kB → buffer is 14924
 - bytesWritten(1460) → buffer is 13464 bytes
 - write 8 kB → buffer is 21656
...

Anyway, as with any networking problem, please isolate *which* side the 
problem happens on. Your description said "server read nothing". Well, *which* 
side had the problem: are you sure the client had sent the data? Confirm with 
tcpdump that the data was being sent.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230523/e03c5387/attachment.bin>


More information about the Interest mailing list