-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Fix handling of errors returned by writev() #36
Conversation
I am happy to report the stream is stable but with glitches in the data for 8 hours now. Will continue monitoring and will report again. The glitches seem to be missing chunks of characters - message lines cut here and there. |
Can you try increasing the UART RX buffer size and the stream server buffer size? uart:
rx_buffer_size: 8192
stream_server:
buffer_size: 8192 I think the stream server might currently be limited to transmitting (about) 60 times its buffer size per second; if you can confirm this fixes it I'll have another look at that.
That's weird, I can't immediately think of anything that would cause this.
It is available in the external_components:
- source: github://oxan/esphome-stream-server@async-tcp |
All right, weird enough. I increased both buffers to 8k. BTW in my previous tests i played with UART buffer only. I didn't know there is parameter from the stream too. |
Now I managed to choke the ESP CPU to death by increasing both buffers further to 16384. The flow rate is reeeally slow and is choppy, barely able to transfer a hundred characters and then goes to complete silence for 4-5 seconds. |
Test - async server. Oxan, please keep the async server in the repository I might need it in the future. Any suggestions how to proceed further with diagnosing the new server? |
Thanks for your input!
The 50 messages per second I can explain, it's a result of the design of the "new" socket-based version. I changed that on purpose because with the old version sometimes the CPU got fully saturated with processing all UART data and didn't get around to any of the normal ESPHome tasks anymore. I'd rather drop a few bytes than choke the entire CPU, though in this case it's clearly behaving suboptimal. I'll have to think a bit about how to get the best of both worlds... |
I'll merge this now as it resolves at least the stream corruption; and I'll leave #32 open to further discuss the issue(s) at high baudrates. |
The highest buffer I was able to test was 8k uart + 8k TCP. Then I went straight up to 16384 and it saturated the CPU (esp8266). |
This should fix the problems reported in #32 and #34.