Java applet crashes

05 Nov 2011

Hiya, any help on Java applets and robustness much appreciated please...

I'm using an mbed with the following libraries: "EthernetNetIf.h", "HTTPServer.h", "RPCVariable.h", "SerialRPCInterface.h" and I have a little Java applet running on the mbed, so I've got everything set up and I'm just using Net::poll(); in a 20ms loop. My RPC variables are working fine and my Java applet works when I type the IP address in a browser window, however, I have a few robustness issues...

1. Some browsers cause the mbed to crash completely, it just hangs as if it doesnt want to talk to the broswer. It doesnt seem to be specific to one browser, eg it works with Explorer on one PC, but doesnt on a different PC.

2. If two browsers try to access the mbed applet at the same time (which I don't actually need, but I do need to be robust against) the mbed hangs also.

I'm relatively new to Java, so maybe there is some way to improve the robustness or reject an attempted access if the applet is already in use, or maybe there is some simple mbed technique which will mean it only operates on healthy comms, so avoiding the hang? Its pretty important to fix this as I'm working on a remotely controlled system, and if the thing hangs then that means an engineer has to physically go to reset the device. Maybe Java isn't the most robust method and I should be using something else?

Any help much appreciated, cheers, Rob.

06 Nov 2011

mini update - just learnt that the reliability is exponentially better if I don't embed an image in the html file, fingers crossed that fixes things longterm :)

07 Nov 2011

agh, my problem has come back despite removing images - when using the mbed as a web server if two browsers try to access at thye same time my mbed and server crashes. Is it possible to set up so that only one broserc can access at any one time? I figure that running the Java applet and all the control code is somewhere getting too much, or are there any particular timing rules i should follow with the Net:poll() method?

29 Nov 2011

bump bump - anybody able to help me out here please? getting pretty desperate to fix this issue...

29 Nov 2011

Hi rob,

Have you got something to reproduce it? Would be good to get to the bottom of this!

Simon

01 Dec 2011

Sounds like it's a threading problem. If you have an image in your html page, then the browser probably starts requesting this on a different http connection before the original page has finished loading - certainly, if you've got more than one image, it would request both these at the same time. If you use fiddlertool (a debugging http proxy), you can examine the timing of the requests. You can enable fiddler to accept connections from non-localhost and configure a remote browser (on a different pc) to use the same instance of fiddler. You can examine the http headers to see what's different between the different browser requests. Tony.

02 Dec 2011

Hello Rob,

I have hit similar issues when I tried to use the HTTP server functionality in the NetServices library. Several months ago I debugged and fixed a few issues in the library but in the end I realized I just wasn't a good enough programmer to discover and fix all of the issues I was encountering. I just wanted HTTP functionality so I decided to start working on my own implementation of just that functionality using the same version of lwIP and mbed library based ethernet driver as used by NetServices. I discarded the rest of the NetServices code.

In a few weeks, I should have the code in a state where I can post it to this site and you can give it a test run to see if maybe it will help with the issues that you are seeing. This will of course only work if you are just using the HTTP server functionality from NetServices since I don't implement any of its other classes. Currently it just supports GETs from a static file system. I will be starting on POST support soon and I can then hook in the RPC functionality that you probably require. The current state of the code is able to obtain 20Mb/sec when handling GET requests for a 10MB test file and handles 2 connections at a time. If the page contains more than 1 image, then subsequent connections will be denied by the server and the client has to retry the image GET later. I have found that different browsers all do the retry but they take a different amount of time to do so which means the performance can look a bit slower than what it really is.

Rob, if I was to get the http://mbed.org/cookbook/Interfacing-with-Java project to work with my HTTP server, would that be enough functionality for you to try it out with your project?

Thanks,

Adam

02 Dec 2011

There have been a myriad of posts about the Ethernet stack / library issues. Initially a few mbed people or others with enough code experience to actually understand (unlike me) and fix it seemed to be tackling the issue. But then it's all gone quiet - actually posts are now just ignored ... so I can only assume that this is a difficult problem without any solution being likely anytime soon - if ever.

I have given up trying to implement any multi socket, mixed TCP/UDP, large MTU or higher bandwidth IP application on mbed. It is just too fragile and it works so much better on alternatives.

I know some have implemented parts of a stack with sufficient functionality for their application, and with apparently good results. However surely this is a major shortcoming / defect of mbed's libraries and needs fixing more officially and completely. I don't quite know how the library maintenance is owned and if there is a responsibility here - or if it really is reasonable to leave it as an exercise for users.

Regardless the flawed mbed network stack is an embarrasment crying out to be fixed....

K

PS Deliberately inflamatory to try and solicit some action....please mbed..... it spoils an otherwise excellent product....