teodesian / Selenium-Remote-Driver

Perl Bindings to the Selenium Webdriver server
173 stars 90 forks source link

Grid connection problem #54

Closed ghost closed 10 years ago

ghost commented 11 years ago

When connecting to Grid servers, the URL called to verify is grid/api/testsession

This URL , for some reason, does not always work properly (error 500). Would it be possible to check URL grid/api/hub/status instead ?

Regards

brianmed commented 11 years ago

How is your environment setup? What version of Selenium are you using? What is the full error?

ghost commented 11 years ago

I'll retrieve the required informations and keep you posted next week.

ghost commented 11 years ago

Sorry for the delay...

here are the capabilities :

"port":"4444", "hubConfig":"/var/selenium2/conf/hubConfig.json", "servlets":[], "host":"ice.appli.xxx", "cleanUpCycle":120000, "browserTimeout":1200000, "capabilityMatcher":"org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "newSessionWaitTimeout":600000, "log":"/var/selenium2/logs/selenium-hub.log", "grid1Yml":"/var/selenium2/conf/grid_configuration.yml", "logFilename":"/tmp/logHub.log", "prioritizer":null, "throwOnCapabilityNotPresent":true, "nodePolling":120000, "proxy":"org.openqa.grid.selenium.proxy.WebDriverRemoteProxy", "maxSession":1, "Dorg.openqa.jetty.SocketListener.bufferSize=10240":"", "role":"hub", "nodeTimeout":600000, "success":true, "timeout":600000

The grid selenium version is 2.28. we moved to 2.32. The error still exists.

The error returned is :

Error 500 Server Error

HTTP ERROR: 500

Problem accessing /grid/api/testsession. Reason:

    Server Error


Powered by Jetty://
markstos commented 11 years ago

Error 500 indicates an error on the server side, not the client side. You should check your server logs to see what the problem is. If you have indication that there's a related bug in this software, feel free to re-open this, indicating what bug you've found in this software.

arjanvanham commented 11 years ago

I have the same problem. Details:

Selenium::Remote::Driver vesion 0.17

Start hub with: /usr/bin/java -jar selenium-server-standalone-2.34.0.jar -role hub Start node with: DISPLAY=:0 /usr/bin/java -jar selenium-server-standalone-2.34.0.jar -Dwebdriver.firefox.bin="/usr/bin/firefox" -role node -hub http://127.0.0.1:4444/hub/register

Test script:

use Selenium::Remote::Driver; my $driver = new Selenium::Remote::Driver (port => "4444");

The first connection works, the second connection generates the error:

Use of uninitialized value in string eq at /usr/local/share/perl5/Selenium/Remote/RemoteConnection.pm line 37. Selenium server did not return proper status at /usr/local/share/perl5/Selenium/Remote/Driver.pm line 232.

Selenium hub generates the following error:

2013-08-11 15:36:30.341:WARN:osjs.ServletHandler:/grid/api/testsession java.lang.NullPointerException at org.openqa.grid.internal.ExternalSessionKey.equals(ExternalSessionKey.java:43) at org.openqa.grid.internal.ActiveTestSessions.findSessionByExternalKey(ActiveTestSessions.java:121) at org.openqa.grid.internal.Registry.getSession(Registry.java:410) at org.openqa.grid.web.servlet.TestSessionStatusServlet.getResponse(TestSessionStatusServlet.java:109) at org.openqa.grid.web.servlet.TestSessionStatusServlet.process(TestSessionStatusServlet.java:67) at org.openqa.grid.web.servlet.TestSessionStatusServlet.doGet(TestSessionStatusServlet.java:51)

Removing the call to 'grid/api/testsession' from Selenium::Remote::RemoteConnection->new makes it work.

I temporarily changed the "new" routine in /usr/local/share/perl5/Selenium/Remote/RemoteConnection.pm as below, but would appreciate a better solution:

sub new { my ($class, $remotesrvr, $port) = @;

my $self = {
             remote_server_addr => $remote_srvr,
             port               => $port,
             debug              => 0,
};
bless $self, $class or die "Can't bless $class: $!";
return $self;

}

johnwarden commented 11 years ago

I have the exact same problem. Here is the corresponding error message on server: 2013-09-19 17:28:03.338:WARN:osjs.ServletHandler:/grid/api/testsession java.lang.NullPointerException at org.openqa.grid.internal.ExternalSessionKey.equals(ExternalSessionKey.java:43) at org.openqa.grid.internal.ActiveTestSessions.findSessionByExternalKey(ActiveTestSessions.java:121) at org.openqa.grid.internal.Registry.getSession(Registry.java:410) at org.openqa.grid.web.servlet.TestSessionStatusServlet.getResponse(TestSessionStatusServlet.java:109) at org.openqa.grid.web.servlet.TestSessionStatusServlet.process(TestSessionStatusServlet.java:67) at org.openqa.grid.web.servlet.TestSessionStatusServlet.doGet(TestSessionStatusServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565) at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479) at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225) at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031) at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406) at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186) at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965) at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.seleniumhq.jetty7.server.Server.handle(Server.java:349) at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452) at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47) at org.seleniumhq.jetty7.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884) at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938) at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:634) at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:230) at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66) at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254) at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599) at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534) at java.lang.Thread.run(Thread.java:680)

markstos commented 11 years ago

Here's the block of code in question:

   if($status->{cmd_status} ne 'OK') {
    # Could be grid, see if we can talk to it
    $status = undef;
    $status = $self->request('GET', 'grid/api/testsession');
 }

Tell us, Grid users, is this behavior for or against the Grid specs and docs? What's the best practice here for creating for a Grid connection?

ghost commented 11 years ago

I am testing the status of $status = $self->request('GET', 'grid/api/hub/status'); instead of $status = $self->request('GET', 'grid/api/testsession');

It works pretty well .

Regards,

Olivier

Olivier Blanc Chargé de la Division Technique Transverse Bureau SI-1C Direction Générale des Finances Publiques

           Tél : 02.40.12.89.09 
           Fax : 02.40.89.13.47 
           Sec : 02.40.12.89.30 

Le jeudi 19 septembre 2013 à 18:43 -0700, Mark Stosberg a écrit :

Here's the block of code in question:

if($status->{cmd_status} ne 'OK') {

Could be grid, see if we can talk to it

$status = undef;
$status = $self->request('GET', 'grid/api/testsession');

}

Tell us, Grid users, is this behavior for or against the Grid specs and docs? What's the best practice here for creating for a Grid connection?

— Reply to this email directly or view it on GitHub.

markstos commented 11 years ago

Do you have a link to an official reference on how this method call should be used?

On dThu, Sep 19, 2013, at 11:13 PM, Olivier Blanc wrote:

ff I am testing the status of $status = $self->request('GET', 'grid/api/hub/status'); instead of $status = $self->request('GET', 'grid/api/testsession');

It works pretty well .

Regards,

Olivier

Olivier Blanc Chargé de la Division Technique Transverse Bureau SI-1C Direction Générale des Finances Publiques

           Tél : 02.40.12.89.09 
           Fax : 02.40.89.13.47 
           Sec : 02.40.12.89.30 

Le jeudi 19 septembre 2013 à 18:43 -0700, Mark Stosberg a écrit :

Here's the block of code in question:

if($status->{cmd_status} ne 'OK') {

Could be grid, see if we can talk to it

$status = undef;
$status = $self->request('GET', 'grid/api/testsession');

}

Tell us, Grid users, is this behavior for or against the Grid specs and docs? What's the best practice here for creating for a Grid connection?

— Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub: https://github.com/aivaturi/Selenium-Remote-Driver/issues/54#issuecomment-24791882

veep commented 11 years ago

I also settled on grid/api/hub/status (or just grid/api/hub) from looking at the Hub.java source. https://code.google.com/p/selenium/source/browse/java/server/src/org/openqa/grid/web/Hub.java and the code for "testsession" support in https://code.google.com/p/selenium/source/browse/java/server/src/org/openqa/grid/web/servlet/TestSessionStatusServlet.java which seems to require a session id.

I don't see grid api docs anywhere.

thephilwells commented 10 years ago

This JavaScript project named 'selenium-grid-status' seems to be checking against ''/grid/console'': https://github.com/davglass/selenium-grid-status

Also that's the path being queried for the functional part of that app anyway so it isn't so much a test-specific path, it's either up and the program works or it's down and the program fails.

Not sure whether that's more or less appropriate for this context than 'grid/api/hub/status' as @olivierBlanc is doing.

mgla commented 10 years ago

Please use grid/api/hub/status instead of grid/api/testsession

ghost commented 10 years ago

I am using grid/api/hub/status since the beginning it's working fine. I was trying to find some specification about tins interface, but it's really not easy. If you have some pointers, I will be please to get them.

On another hand, I was looking at the new features coming with version 2.41 of Selenim, especially the "fire-event" function. Does anyone had a look on it and how to implement it in perl ?

gempesaw commented 10 years ago

Cool, I'll switch that line over to grid/api/hub/status.

What's fire-event?

mgla commented 10 years ago

Thanks!