Webserver randomly becomes unresponsive
chillybasen
Posts: 16
I'm using Bean's code, but I've had this happen with Mike's as well
Everything works perfectly fine, sometimes for days. And then I'll just be unable to connect. I tried telneting to port 80 and it won't even connect. It just times out.
If I reset it, everything is fine again.
Anyone else experiencing this? Any ideas on how to fix?
Everything works perfectly fine, sometimes for days. And then I'll just be unable to connect. I tried telneting to port 80 and it won't even connect. It just times out.
If I reset it, everything is fine again.
Anyone else experiencing this? Any ideas on how to fix?
Comments
nope have not solve it yet.
also when my page is viewed on my network it is fine when viewed from the web it is cut short.
One solution might be to introduce a timeout if the data packet is not cleared to zero length in a reasonable amount of time.
I was testing a program that was border line and adding a few extra spaces caused the Spinneret to hang.
It has to do with the number of BYTES you are sending at once to the W5100 .... It breaks if you try to send more than 2048 bytes at once. Looking at the code at the very top...
bytebuffersize = 2048
.... So apparently That's my sign, smack it right on my forehead :-) Duh!
EDIT Breaking down the html code length seems to have solved my problems with the Spinneret becoming unresponsive.
I'll mess around with it a bit tomorrow to see if I can characterize my Spinneret's behavior a little better..
I say partially, because I literally just stumbled on what appears to be the problem... in other words it should have further confirmation.
Sending the string size to the serial terminal just before sending it to the W5100 is where I had an 'Ah Ha' moment.
To answer your question... it doesn't hang right now, but under previous conditions I can cause it to hang.
I'll let it run until tomorrow, but at around 6pm I need to take it off-line ... (Meeting with Robotics group) ... and I actually don't have a Spinneret
of my own. The one I'm using is being borrowed from the Robotics club, go figure :-)
Also, there is no check in the driver for the situation where you are trying to send a string longer than the buffer size. If you do, the driver will hang forever.
I patched this bug weeks ago and posted it here. It's not really a matter of the size of the W5100 buffer, but the concept of the TCP implementation.
Again, you find my patched version at http://whiteboard.ping.se/Propeller/Network.
Thanks! I've implemented your patch for the Indirect driver on the Web server... If all goes well
it will still be up and running by 6pm tomorrow. ...Leaving it alone til then.
http://spinneret.servebeer.com:5000
Check out the xml stylesheet transform (xslt). Works in IE not Firefox and I'm not sure about other browsers. I think I know what's up though. Will check when I get home from work.
http://spinneret.servebeer.com:5000/xslt/sensor.xml
Also the configuration link pulls Spinneret settings from EEPROM. The save button only shows the posted values.
I'm able to pretty easily recreate the issue now by using apache benchmark
ab -n 300 -c 1 http://192.168.1.252/
After around 250 requests, it hangs. I'm guessing the number of requests is dependent on the size of bytes being received and sent
Shawn
Your XML style sheet does not work in Chrome. I get the following error:
"
This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error."
Followed by a blank page. Just FYI...
With my code, there is no longer any 2K boundary. It is all handled internally in a sound way, and you can transmit (e.g. enqueue) a 10kB request with txTCP as TCP is supposed to work. Try it out some more, and if you still believe it is the driver, I'll have another look at it.
Shawn
It sounds like a race condition. Do you check you have processed everything before clearing the interrupt, or do you only process one event?
Perhaps I should try this variation when I get home tonight:
I'll let you know what happens.
Shawn
I'm not convinced that this is an issue within the W5100 ... I still think it might be how the software handles the W5100. Anyone run a trace as to where 'in code' the Propeller is when this happens?
The reason I'm still leaning that the W5100 is not at fault is because I can hit it when it 'appears' to be locked up and the Status lights respond as I would expect them to. ... The page just doesn't load, 'I think' because the code is looking for something else to happen and doesn't see the request in order to present the html code to the browser.
http://spinneret.servebeer.com:5000/docs/32203.pdf
Right now, my interrupt code only responds to a socket 0 connection established interrupt. All other interrupts are ignored. I will also check the status of the ISR when the server locks up to see if it is waiting for something to happen, like waiting for me to reset the socket after a connection timeout or similar. I'll post back when I get home.
Shawn
Below is a copy of the source. The most notable thing is the presence of a blank line as the first line in the file.
Ethernet Capture.zip
*Edit - I should qualify the above attachment with the fact that the Prop/W5100 is located at 192.168.0.100 and the PC is 192.168.0.102
http://spinneret.servebeer.com:5000/xslt/sensor.xml
I had the web server up all day. The server received 1780 hits and no crashes not too shabby. I requested the spinneret pdf several times which is 500k and no problems. I'm seeing timeouts in my log file. Not sure of the cause. When a timeout occurs the I reset the socket, that's seems to work pretty good.
@sstandfast, thanks for the Ethernet capture.
Hello,
I have found a bug in the SPI driver re truncating transmitted UDP packets. Since you have addressed a couple of other issues in your version you may want to add that fix as well, that way there will be a single version that has all known bug fixes. It's referenced in another thread on this forum, also in the collaberation thread.
It appears to be a timing issue, especially if you have dynamic HTML code that is generated.
We reduced the html down to bare minimum, and the hang problems went away, but we could introduce a controlled amount of delay of the html generation and the hang problems came back.
minimum HTML code:
The two lines above are sent separately using ... StringSend
An adjustable delay using ... PauseMSec ... between the two lines was used to simulate an 'html creation' delay.
A separate cog for html generation might be required, but then you introduce a latency with the most recent data.
This might boil down to a speed issue between Spin vs. Pasm.
...Anyway, just thought I would pass this info along. I think the software driver is ok, and the 5100... it's a UCE 'user code error' problem.