Issue Details (XML | Word | Printable)

Key: GRID-14
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Philippe Hanrigou
Reporter: bruce
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Selenium Grid

Unregistration

Created: 10/Nov/08 02:56 AM   Updated: 07/Jan/10 02:18 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None


 Description  « Hide

unregistration of remote control



Sort Order: Ascending order - Click to sort in descending order
Philippe Hanrigou added a comment - 10/Nov/08 01:28 PM

Please provide more information/context about this bug. Quite hard to guess what the problem is with the current data.

Thanks in advance!


bruce added a comment - 10/Nov/08 07:05 PM

register a remote control to the hub. and then i want to close the remote control, how to unregister it from the hub. if i close the remote control directly, it would be error when i register it again. it warning the remote control is already registered.

the warning message is -------------------------------------------------------
[java] 2008-11-11 09:00:20.821::WARN: /registration-manager/register
[java] java.lang.IllegalStateException: attempting to add a remote control
that is already registered: [RemoteControlProxy localhost:5555 0/1]
[java] at com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteContro
lProvisioner.add(RemoteControlProvisioner.java:68)
[java] at com.thoughtworks.selenium.grid.hub.remotecontrol.GlobalRemote
ControlPool.register(GlobalRemoteControlPool.java:34)

-------------------------------------------------------


Tobias Stiftner added a comment - 29/Jan/09 04:47 AM

Hi Philippe,

I think I have the same, or at least a similar issue. Maybe I can clarify the comments of bruce.

I have a grid hub running and 4 grid clients are registered to it. (all clients are running on different windows xp machines)
It happens from time to time that I need to restart a grid client due to different reasons (changes in the ui-elements whatsoever)
I'm doing this by hitting ctrl+c in the clients command line window.
The Hub doesn't recognise that the client isn't running anymore, hence it is still flagged as registered to the hub.
Starting the client again results in the exeptions below. The only way of fixing this is to restart the hub and all other clients, which is quite annoying when having a distributed setup.
IMO the client should unregister himself from the hub before shutting down. But it seems he's not really doing so. Or do I need to stop the client in a different way?

many thanks
Toby

Exception on the hub:
[java] 29.01.2009 11:35:13 com.thoughtworks.selenium.grid.hub.management.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] 2009-01-29 11:35:13.021::WARN: /registration-manager/register:
[java] java.lang.IllegalStateException: attempting to add a remote control that is already registered: [RemoteControlProxy 10.0.20.129:5555 0/1]
[java] at com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlProvisioner.add(RemoteControlProvisioner.java:68)
[java] at com.thoughtworks.selenium.grid.hub.remotecontrol.GlobalRemoteControlPool.register(GlobalRemoteControlPool.java:34)
[java] at com.thoughtworks.selenium.grid.hub.management.RegistrationServlet.process(RegistrationServlet.java:29)
[java] at com.thoughtworks.selenium.grid.hub.management.RegistrationManagementServlet.doPost(RegistrationManagementServlet.java:18)
[java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
...

Exception on the client:
[java] 29.01.2009 11:38:46 com.thoughtworks.selenium.grid.remotecontrol.RegistrationRequest execute
[java] INFO: Registering to http://localhost:4444/registration-manager/register
[java] Exception in thread "main" java.lang.IllegalStateException: Could not register successfuly to http://localhost:4444/registration-manager/register
with environment 'Firefox 3.x on WinXP'. Most likely this environment is not defined on the hub.
[java] at com.thoughtworks.selenium.grid.remotecontrol.RegistrationRequest.execute(RegistrationRequest.java:28)
[java] at com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControl.register(SelfRegisteringRemoteControl.java:31)
[java] at com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher.main(SelfRegisteringRemoteControlLauncher.java:26)


Tobias Stiftner added a comment - 29/Jan/09 04:49 AM

...forgot to mention that I'm using grid version 1.0.3


Ian Fraser added a comment - 10/Sep/09 12:25 PM

I too am also having this problem.


tom ketchup added a comment - 23/Nov/09 01:20 PM

This issue is duplicated by GRID-14. I have also encountered this. When troubleshooting or developing a new grid environment I often restart individual RCs. However doing so with the current code makes it so there isn't a way to do it without shutting down the hub and all of your other RCs in the grid.

To rephrase the issue: If you start up a new remote control and then stop it (stop it's process), you can't start it again because the hub still thinks it's registered. The hub will give the registration-manager exception posted above by Tobias.

The server just has to implement the case of un-registration. But not only by manual shutdown of the RC, it should handle any case where the RC disconnects for other reasons.

The solution should probably be simply that the hub server pings the RC once it is "registered" (or the other way around, but I think it makes more sense for the hub to ping the RC) and un-register if it fails to respond.

The only tricky case I'm thinking of at the moment is if the connectivity was interrupted because of some temporary network situation, and the RC is still up after the interruption and tries to talk to the hub, does it re-register automatically or is there an exception, what is the message for the exception if so.


Philippe Hanrigou added a comment - 23/Nov/09 01:49 PM

Hi,

If this bug is a blocker for you, you might want to try the version in trunk which already handle gracefully most of these cases. You can build Selenium Grid from source using the github repository:

http://selenium-grid.seleniumhq.org/build_it_from_source.html

Cheers,

  • Philippe

Richard Walter added a comment - 07/Jan/10 02:18 PM

I'm not sure if pinging other RCs is the answer (but, I'll leave that decision to the developers).

However, I would like to point out that the current version of Selenium (1.0.4) does feature unregistration.

If you send the following POST request to wherever your Selenium Grid is located, the RC will unregister.

POST http://gridlocation:gridport/registration-manager/unregister HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.0.1
Host: gridlocation:gridport
Content-length: 52
Content-Type: application/x-www-form-urlencoded

host=RClocation&port=RCport&environment=Firefox+on+Windows

I created a java program that takes the host, port, and environment as inputs and then sends a POST request to the Grid. The result is the RC gets unregistered (resulting in never having to re-start the Grid due to a RC getting in a bad state).

Although I noticed that Philippe is implementing a HeartbeatServlet, so I think I might check out how that works.