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

many calls of WebSerial.println in a row causes problems #11

Open
peff74 opened this issue May 15, 2023 · 9 comments
Open

many calls of WebSerial.println in a row causes problems #11

peff74 opened this issue May 15, 2023 · 9 comments

Comments

@peff74
Copy link

peff74 commented May 15, 2023

Hi,
Brilliant libary!

I had big problems with stuttering output at the beginning.
Especially when many WebSerial.println came in a row in the skipt:

WebSerial.print ("Measurement_count: );
WebSerial.println (Measurement_count);
WebSerial.print ("Unix-Time: ");
WebSerial.println (now);
WebSerial.print ("Records in cache: );
WebSerial.println (queue.size());

After replacing this with the following, it worked better:

snprintf(printbuffer, sizeof(printbuffer), "Measurement_count: %i \nUnix-Time: %ld \nRecords in cache: %i", Measurement_count, now, queue.size());
WebSerial.println(printbuffer);

Also, I think it is very important to make an adjustment to the AsyncTCP:
me-no-dev/AsyncTCP#121
Without this change it kept crashing every few hours.

@asjdf
Copy link
Owner

asjdf commented May 15, 2023

Thank you for using this library. I thought you meet the same problem mentioned in #4

Did the FAQ solve your problem? I currently think that in order to ensure the lightweight of the library, the function of caching messages should be implemented by AsyncWebSocket, because WebSerialLite cannot know whether the message queue in AsyncWebSocket has been emptied.

@peff74
Copy link
Author

peff74 commented May 15, 2023

There is a german proverb:
"Those who can read are at a clear advantage!"
Of course, I have not watched the FAQ...

I currently used this version of the AsyncWebserver:
https://github.com/yubox-node-org/ESPAsyncWebServer/tree/yuboxfixes-0xFEEDC0DE64-cleanup.

Because these are used at e.g. here:
https://github.com/tbnobody/OpenDTU
https://github.com/lumapu/ahoy
Both projects have a serial monitor as a web page

Is the ESPAsyncWebServer from ESPHome better?

I have now increased the WS_MAX_QUEUED_MESSAGES to 32.
Which value is useful here, if 3-4 WebSerial.println are run per second?

What is about the menetoried "issue" int the AsyncTCP is this somehow related?

@asjdf
Copy link
Owner

asjdf commented May 15, 2023

ESPHome/ESPAsyncWebServer seems to be updating a bit more aggressively, so I was using ESPHome/ESPAsyncWebServer, and so that I submitted a PR to it, but the original version is actually ok, you can make a PR to the original version if you like.

Actually I don't know which value of WS_MAX_QUEUED_MESSAGES if suitable for you, you'd better make some tests by yourselves. Sorry for can't help you. 😟

If you want to solve the issue about "many calls of WebSerial.println in a row causes problems", I thought change the WS_MAX_QUEUED_MESSAGES is enough. If you want to solve the issue me-no-dev/AsyncTCP#121 , I thought you can try to use https://github.com/yubox-node-org/AsyncTCPSock

@asjdf
Copy link
Owner

asjdf commented May 15, 2023

I thought the ESPAsyncWebServer you are using is cool! There are a lot of new features! I like it.

@peff74
Copy link
Author

peff74 commented May 15, 2023

The issue "many calls of WebSerial.println in a row causes problems" is fixed with changing value of WS_MAX_QUEUED_MESSAGES. Perfect :-)

The other problem I pointed on I've already fixed by editing the AsyncTCP.cpp as described in me-no-dev/AsyncTCP#121.
I only want to let you know about this, because with the original lib the ESP crashes frequently.

But now I'll try out our suggestion, it seems completely rewritten.

@asjdf
Copy link
Owner

asjdf commented May 16, 2023

Thanks for the report, I think the problem has been solved. Can I close this issue and mark it as resolved?

@peff74
Copy link
Author

peff74 commented May 16, 2023

I have one more question, but I am not sure if it is related to your library.
But it occurs only in combination with your library.

What happens is this.
If I run the tab with your serial monitor and then open up another tab e.g. google in the browser for some time (10-15 minutes), and then get back to the Serial Monitor page it turns completely blank.
Reloading does not work either.
After a while, a message appears that the website is no longer responding.
Only the complete closing of the tab and reopening works again.

@asjdf
Copy link
Owner

asjdf commented May 17, 2023

The problem you meet looks like issue #10 , but I can't reproduce the bug mentioned in #10, I will try to reproduce at this weekend. I am glad if you can help me to solve this bug.

@peff74
Copy link
Author

peff74 commented May 17, 2023

Hi,

I'm not sure if it's the same error.
Because with me there are partly 6000 lines in your tool.

But I can gladly test it.
Also, ESP crashes every now and then since your library has been in use.
At the moment I have
https://github.com/yubox-node-org/AsyncTCPSock
https://github.com/yubox-node-org/ESPAsyncWebServer/tree/yuboxfixes-0xFEEDC0DE64-cleanup
in use.

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

2 participants