Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling flushIOBuffers() May cause data loss. #582

Open
brianmichalk1 opened this issue Nov 11, 2024 · 0 comments
Open

Calling flushIOBuffers() May cause data loss. #582

brianmichalk1 opened this issue Nov 11, 2024 · 0 comments

Comments

@brianmichalk1
Copy link

I think the documentation needs a warning that this method may cause loss of data.

I haven't confirmed all of the details, but I think the different driver implementations of flush() may not be consistent.

In my specific case, write() followed by flushIOBuffers() occasionally caused data loss. I think its a race condition where write() returned without error, but the OS driver has not yet begun transmitting, or is maybe in the process of transmitting. Instead of flush() waiting for buffer to empty, it simply clears the buffer. My understanding is that flush signals the driver to begin transmitting (ignore timeout), then blocks until buffer is empty. Of course my understanding could be wrong on this.

My receiving device is an ESP32-S3 CDC serial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant