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

periodic_service() function is running too often #144

Closed
nielsonm236 opened this issue Feb 23, 2023 · 1 comment
Closed

periodic_service() function is running too often #144

nielsonm236 opened this issue Feb 23, 2023 · 1 comment

Comments

@nielsonm236
Copy link
Owner

I had noticed from time to time that the Configuration webpage would be corrupted when displayed. This problem became worse when changes were made to accommodate the new PCF8574 functionality. On investigation I found that many re-transmit errors were occuring, particularly with with Configuration page (which has the largest HTML/javascript content of all the webpages). The problem appears to be that various timeouts, in particular the re-transmit timeout (rto), were occurring very often, and when a large number occurred webpage display could be corrupted. I traced this issue to the frequency of the periodic_service() routine, which is used as the "timer" in the uip code.

The periodic_serivce() routine is called primarilly by the periodic_timer_expired() function. I recall decreasing this timeout long ago when I was attempting to improve webpage display timing and MQTT timing. On looking at code it appears I improved the MQTT timing by adding a periodic_service() call whenever publish_outbound() is called - so that was probably my ultimate fix for MQTT timing improvement. However, it looks like I left the periodic_timer_expired() time at about 20ms, which in turn is causing the re-transmit errors.

I've changed the periodic timer to expire at 80ms, which appears to have completely eliminated the retransmit timeout problem. However, the way the code is designed right now I can see the possibility that with very heavy MQTT traffic the uip retransmit timeout problem could reoccur.

So, two outcomes:

  1. The current change, while appearing to fix the retransmit problem, might have changed MQTT timing a little. Some users may have to re-test if they are very sensitive to MQTT performance. From code examination I don't think there will be any difference.
  2. Going forward I may have to look more closely at the periodic_service() routine and see if I can separate the way MQTT and Browser traffic is handled.
nielsonm236 added a commit that referenced this issue Mar 7, 2023
#115 "How to enhance the needed pins for sensors? Can the PCF8574 module be useful?"

#120 "Pin order as build options"

#141 "Selectable pinout branch"

#142 "Added REST command /50 (at /80)"

#143 "Linked pins check in check_runtime_changes() should be in check_eeprom_settings()"

#144 "periodic_service() function is running too often"

#145 "Timer error has gradually increased - need improved time keeping function"

#146 "Incorrect content-length for most pages returning content"
@nielsonm236
Copy link
Owner Author

Addressed in 20230305 1816

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