[jboss-jira] [JBoss JIRA] Commented: (JBASM-28) testTimeoutStop test failure since changes to ServerController.java were implemented
Richard Achmatowicz (JIRA)
jira-events at lists.jboss.org
Fri Feb 13 11:16:55 EST 2009
[ https://jira.jboss.org/jira/browse/JBASM-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12452602#action_12452602 ]
Richard Achmatowicz commented on JBASM-28:
------------------------------------------
OK. I've found the root cause of the failure of the test FailStartStopTest.testTimeoutStop.
1. Just for your information - some info in the test and the failure:
testTimeoutStop() starts a server instance which deliberately ignores a shutdown command. The test then calls ServerController.stopServer() to stop the server. Because the server ignores shutdown, it triggers a shutdown timeout exception. The test case then goes on to confirm that (i) the timeout exception was raised and (ii) the server should have been killed, where "should have been killed" is implemented by checking that ServerController.isSrerverStarted() is false. The test is failing because, even though the timeout exception occurs, and even though the Process.destroy() command is called, the server still responds to HTTP/RMI requests when after the call to ServerController.stopServer() is made.
2. In ServerController.stopServer(), if a process does not shutdown before the timeout, it is destroyed. There was a sleep of 45 seconds after the call to Process.destroy(). I couldn't see the purpose for it, and there was no comment, so I removed it. What this means is that when ServerController:stopServer() exits, (i) the Process.destroy() call has been made, (ii) isRunning() will return false, but ServerController.isServerStarted() may still return true, as the server is *in the process* of shutting down. With the 45 second delay in place, there was a greater chance that the server would have had time to shut down by the time ServerController.stopServer() exits, and so a subsequent call to ServerController.isServerStarted() would return false. Reintroducing the 45 second delay causes the test to pass.
3. What to do?
There are two methods to check the status of a server: Server.isRunning() and ServerController.isServerStarted(). These really should be such that if isRunning() returns false, then isServerStarted() should also return false, but there is no such check and at present it does not hold in the case where a process has been destroyed and is in the process of shutting down. Rather than get into a long discussion about whether or not ServerController.isServerStarted() should first check of the server is running and the effects on the operation of the testsuite, i'll just reinstate the delay.
But to make this hidden issue more transparent, i'll name the constant PROCESS_DESTROY_DELAY and make a comment about why its is needed.
If the delay were left out, there is a possibility that a <server:stop/> followed immediately by a <server:start/> would trigger a "port 8080 already in use" startup exception.
> testTimeoutStop test failure since changes to ServerController.java were implemented
> ------------------------------------------------------------------------------------
>
> Key: JBASM-28
> URL: https://jira.jboss.org/jira/browse/JBASM-28
> Project: JBoss AS Server Manager
> Issue Type: Bug
> Reporter: Shelly McGowan
> Assignee: Richard Achmatowicz
>
> Richard, I'll have to ask you to take a look at these. They seem to occur since the changes you've committed. After losing the history of ServerController.java it is difficult to know what was exactly changed. To run the tests, you will need an JBoss AS 5 installation built as the tests start and stop the default server config.
> -------------------------------------------------------------------------------
> Test set: org.jboss.jbossas.servermanager.test.startstop.unit.FailStartStopTest
> -------------------------------------------------------------------------------
> Tests run: 3, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 107.081 sec <<< FAILURE!
> <testcase classname="org.jboss.jbossas.servermanager.test.startstop.unit.FailStartStopTest" time="107.059" name="testTimeoutStop">
> <error type="java.lang.IllegalArgumentException" message="The default is not running; it cannot be stopped.">java.lang.IllegalArgumentException: The default is not running; it cannot be stopped.
> at org.jboss.jbossas.servermanager.ServerController.stopServer(ServerController.java:373)
> at org.jboss.jbossas.servermanager.test.startstop.unit.FailStartStopTest.after(FailStartStopTest.java:227)
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list