Why data to the tcp frame is split into 2 tcp segment and the second segment is lost?


Send JSON from 1Сv8 with nginx (proxy to unicorn backend) via a POST request.

Part requests comes fine but some get response from nginx 400. Turned on the logging request body and saw that the JSON does not come fully - cropped part of a query at the end.

Looked traffic wireshark'ohms and found that these queries consist of 9 Reassembled TCP Segments. Moreover, only in the problematic queries, I see 2 TCP segment data. And just this second segment somehow is truncated.


1. Why can be split into 2 TCP segment data?
2. Why in the reassembled tcp segment misses?

Thank you.
1 answer
July 8th 19 at 11:46
I think TCP is not being, unless the client closes the connection without reading the response from the server, then it is possible if the socket is linger. But most of all, it's just a bug in the client, the developers did not take into account that the function send() sent all the data from the buffer, a mistake the developers do not have experience of writing network clients do often enough.
Thank You, Vladimir. By the way, I forgot to mention that the client sends RST after it receives 400 from server. - viva93 commented on July 8th 19 at 11:49
ae849633cd6948e7880811f222392af9.png - viva93 commented on July 8th 19 at 11:52
This fragment shows that it was the first case. Ie the client sends a request to the socket and then closes it. If the socket is linger, the data was in the buffer and have not been sent is lost. If you can control this process in your code - consider the response to the request to close the socket, if you can't, send a bug report to the developers. - Robb45 commented on July 8th 19 at 11:55

Find more questions by tags Network administrationJSONWiresharkComputer networks