On 09/25/2010 11:05 AM, Patricia Shanahan wrote:
I needed to do a general reset before starting a new set of tests. I completely shut down (virtual power off) all my VMs and restarted the system. This happened during the first build I did after restarting the VM in question. Before the build, I had run gedit but no tests. If it is a testing framework problem, it has to be in the junit testing that is done during the build.
The operating system is not without state, so a test might be influenced by the state changes in the OS from the previous test.
For instance when a server socket is opened, and closed, you cannot immediately bind on that same server socket, unless you specify SO_REUSEADDR with setsockopt(). This is because after closing the socket stays in TIME_WAIT2 state for some time.
So if you forget to specify SO_REUSEADDR on your server sockets, and run the same test in rapid succession, it might fail.
I did a small codereview on the TcpServerEndpoint, and no mention of the ServerSocket.setReuseAddress() call, so that is a potential cause.
Gr. Sim
