Skip to content

[Bug] Socket->Send() Sometimes Corrupted Data / Resending Previously Sent Data / Slow Chunking #681

Description

@davefilip

You have found a bug in Circle? Please fill out this form!

Description of the bug

Rene,

I have recently started upgrading my Circle-based OS from Step 50 to Step 51, given that it sounds like the network layer has been improved, and I am excited to try the new IPC (pipe) functionality.

The upgrade was easy, and I didn't need to modify any code this time (vs. going from 49 to 50 which required some refactoring).

However, I did start having a problem with Step 51 related to network sockets.

I have a telnet server that I wrote 2+ years ago, that had been working reliably since. However, with Step 51 I've been having some reliability problems, which seems to be related to calling CSocket->Send():

CLogger::Get()->Write(LogSource, LogNotice, "[%d] %s", strlen(string), string);
m_Socket->Send(string, strlen(string), MSG_DONTWAIT);

I added the Clogger line before it to verify that the string being passed is good, and the length is valid (i.e., not is never an unterminated string, the parameters are valid as displayed on the conosle).

Although I have no problem receiving data from a telnet client, sending data to the telnet client with the same kernel may or may not work depending on the RPi model and WiFi access point.

Sometimes it works fine, but sometimes will re-send fragements of data that has previously been sent, or add what looks like lots of blank lines, and sometimes it also displays the proper text but gets very choppy (seconds between each fragment of text sent).

I have done a lot of testing, and I suspect that it might be related to some combination of processor and network speed, based on the following (all using the EXACT SAME kernel image):

A. RPi 3B + High Speed Mesh WiFi - have not seen any problems

B. RPi 3B + Medium Speed Pocket WiFi (1) - mostly reliable, can occasionally see a problem

C. RPi 3B + Low Speed RPi Hotspot (2) - Frequently works but can sometime see the problem

D. RPi Zero 2W + High Speed Mesh WiFi - Frequently works but can sometime see the problem

E. RPi Zero 2W + Medium Speed Pocket WiFi (1) - Sometimes works but frequent problems

F. RPi Zero 2W + Low Speed RPi Hotspot (2) - Lots of problems, mostly unusable

Note: 1 - MikroTik mAP (2x2 inch battery)
Note: 2 - Raspberry Pi 3B running HostAPD + DNSMasq

For my current project, ideally I need to get (F) working for an IoT project on a remote platform.

And of course reverting back to the old (Step 50.0.1 based) kernel still works flawlessly in all of these environments.

In your release notes you've stated:

This release offers a significantly improved implementation of the TCP/IP network stack. It supports TCP congestion control according to RFC 5681 with Fast Retransmit and Fast Recovery.

Just to eliminate those as a possibility, is there any define (-D) to turn off the congestion control and/or Fast Retransmit + Recover capability?

Otherwise, any ideas on how to further troubleshoot this?

Thanks,

Dave.

Affected version(s) and hardware

What version(s) of Circle show this bug? On which Raspberry Pi model(s) did you notice this bug? Which additional hardware has been used?

51, 3B and Zero 2W (see above for specific test results)

Log output or screenshots

Corrupted output with fragements of prior text appended to correct text, or sometimes correct text truncated, and sometimes a second or two between each fragment of text.

Textual log output goes here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions