Partial tables from RabbitWeb

I am using a Rabbit for temperature & humidity data logging and have tables of several hundred measurements (date, time, temp, humidity) accessed via HTTP and a browser. Sometimes the tables are displayed and sometimes they are partially displayed and the browser displays “Waiting for WW.XX.YY.ZZ” followed by “This page can’t be displayed”.
I can make the tables smaller, but I would rather not. Waiting for the table to be completed is not a problem. Looking for other solutions.
The http handler is in a loop with a costate section that does the data processing.


while (1) {
 http_handler();
 costate {
   waitfor(DelayMs(20000));
     data processing
  }
}

I think that the http_handler() should be inside of its own costate block, along with a “yield;” to allow execution of the other block.

Thanks. I did some more testing and it isn’t specific to costate. See my update.

I have tried some experiements, like removing the costate and using a simple if statement to process data every 20 seconds. I also added an elapsed time printf and I found
that it takes multiple calls to the http_handler() function to transfer the table, ~ 20 or so. Each call lasts from ~30mS to ~180mSec.

  1. Using the code below, I get the elapsed time of each handler call, but the browser freezes before the complete table is sent.
  2. If I comment out the if & printf statement then I get all the table transferred.

while (1) {
   t0 = MS_TIMER;
   http_handler();
   delta = MS_TIMER - t0;
   if (delta > 10l) printf("
http: %ul", delta);
}

It sounds like the data processing you do every 20 seconds might stall the HTTP server enough to break the connection. Is this while the debugger is running, or with STDIO redirected to a serial port?

Note that you should use the “%lu” format specifier for an unsigned long. The print works correctly because you’re just printing the lower 16 bits of “delta”.

I’m also wondering about buffer allocation what happens if you increase the value used for MAX_TCP_SOCKET_BUFFERS ?

How complex is your zhtml? Can you reduce the number of tags to simplify processing?