SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

Session not available when running tests with Selenium Grid 2.0.0 #2037

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 2037

After upgrading to Selenium Grid 2.x we have seen a number of tests failing with the
message "org.openqa.grid.internal.GridException: Session not available - [6d1e7c9a-cdb1-4a26-bddf-0916e942fbda
(int. key, remote not contacted yet.)]"

The tests are consistently either calling selenium.set_timeout (may be significant
only in that it immediately follows selenium.start), or -- less often -- selenium.stop

The hub console during these errors is empty, and it is not thought that these are
genuine timeouts. The timeout is set to 3 minutes.

The issue is more prevalent when running multiple multi-threaded builds at once. In
one instance I was running up to 24 browsers in parallel over 4 nodes. In another,
we were running 8 browsers over the same 4 nodes.

Selenium version: 2.0.0
OS: Mac OS X 10.6.8
Browser: Firefox 
Browser version: 4

Reported by dave.hunt on 2011-07-12 11:11:08

lukeis commented 8 years ago

Reported by francois.reynaud on 2011-07-12 11:17:22

lukeis commented 8 years ago
Hi, I'm having the same problem since 2.1.0. 
Tests that never failed are now failing sometimes.

Some tests fail even before they start. This is the warning from HUB:

Warning: session ext. key c24f616f4ef14fc4840b33680df13168 has been ORPHANED and will
be released.

And here ist the exception:

Session not available - [c24f616f4ef14fc4840b33680df13168 (int. key, remote not contacted
yet.)]

Selenium version: 2.1.0
OS: Windows XP
Browser: Firefox
Browser version: 5

Reported by jackatkoeln on 2011-07-28 13:03:59

lukeis commented 8 years ago
Are you doing anything strange list creating a session and then never sending any other
commands?  The ORPHANED bit basically means the session was created but then no other
commands were routed to it.

Reported by nirvdrum on 2011-07-28 13:35:14

lukeis commented 8 years ago
It's strange but it seems that the session is not starting fast enough. 
When I run the tests at my local machine is everything okay. But when I start the same
tests at a remote desktop I always get these exceptions. This hapens because the session
is taking to long to be initialized. Any workarounds? Thks.

Reported by jackatkoeln on 2011-08-01 13:24:36

lukeis commented 8 years ago
I'll have to double-check later, but I don't think the orphan check happens until after
the session has fully started.  If not, that's a bug.

Reported by nirvdrum on 2011-08-01 13:45:21

lukeis commented 8 years ago
I think two issues have been confused here. The original -- sessions being unavailable,
and a second -- sessions being orphaned. For those experiencing the latter please raise
a separate issue and provide as much detail as possible.

I'm not sure which issue comment 6 relates to, but I can say that the original issue
that I reported does indeed occur with Selenium RC nodes.

Reported by dave.hunt on 2011-08-02 13:06:40

lukeis commented 8 years ago
@Dave, I was actually referring to the original issue only. I tried multiple times to
recreate the session being unavailable issue using RC node, but couldn't. Since you
said you are able to replicate it, I can delete my previous comment

Reported by anandj82 on 2011-08-02 13:22:24

lukeis commented 8 years ago
Okay, thanks for the clarification.

Reported by dave.hunt on 2011-08-02 13:38:52

lukeis commented 8 years ago
Did anyone face this issue in IE or googleChrome? Or is this happening only in FF?

Reported by anandj82 on 2011-08-16 15:14:10

lukeis commented 8 years ago
@Dave, while starting the node, did you use the default setting for browsers? Or did
you specify -browser parameter? I am just trying to see whether this issue is specific
to any browser OR scenario. 

Reported by anandj82 on 2011-08-18 16:27:27

lukeis commented 8 years ago
Hello,

I have the same issue, randomly. For info it's IE 7 only:
java -jar selenium-server-standalone.jar -role rc -port 4444 -hub http://myhub:4444/grid/register
-browser "browserName=*iexplore,version=7,maxInstances=3,platform=WINDOWS"

Regards,
Julien

Reported by julien.yo on 2011-08-19 07:39:36

lukeis commented 8 years ago
@Julien: I think your issue is different. Have you tried a single server, no grid, and
multiple IE. Last time i tried i was only possible to start 1 IE per OS using the java
client.
thanks
françois

Reported by francois.reynaud on 2011-08-19 08:56:00

lukeis commented 8 years ago
All, 
I have been running few tests continuously to see whether there is a pattern for this
failure. Here is what I have found

During the test, one of the requests will get timed out. From what I have seen, the
page doesn't load completely when this issue happens. This causes a node TIMEOUT to
happen. Hub would then send Delete Session command to the node, but that command doesn't
get any response from node. I could still see the browser open and waiting for the
page to load even after that delete session command was executed. 

I don't know the reasons for both, but thought it might help in resolving the issue.

Reported by anandj82 on 2011-08-19 14:47:59

lukeis commented 8 years ago
Is there anything that I can do to get this issue fixed?

Reported by anandj82 on 2011-08-23 17:00:25

lukeis commented 8 years ago
Whilst testing with 2.5 I have seen an additional message with these failures:

Error 500 org.openqa.grid.internal.GridException: cannot forward the request Timeout
waiting for connection

It would appear that this relates to line #153 in /trunk/java/server/src/org/openqa/grid/web/servlet/handler/RequestHandler.java

As a result of this timeout the session is terminated, which would explain the following
failure of session not available.

Reported by dave.hunt on 2011-08-24 16:30:20

lukeis commented 8 years ago

Reported by stephen.donner on 2011-08-25 18:36:45


lukeis commented 8 years ago
Are there more changes which are yet to be committed for this issue? I took the latest
from repository yesterday. I could still replicate the issue. Error message is same
as the previous one. 

Reported by anandj82 on 2011-09-01 15:23:51

lukeis commented 8 years ago
Reopened

Reported by kristian.rosenvold on 2011-09-01 16:28:39

lukeis commented 8 years ago
I'm no longer seeing this with Selenium 2.6.0. Please reopen if anyone can reproduce
with the latest version.

Reported by dave.hunt on 2011-09-14 12:05:10

lukeis commented 8 years ago
Hi Dave, it still doesn't work for me. Below outputs from the console for hub and client:

Server:

D:\>java -jar selenium-server-standalone-2.6.0.jar -role hub
14-Sep-2011 14:27:21 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
14-Sep-2011 14:27:21 org.openqa.jetty.http.HttpServer doStart
INFO: Version Jetty/5.1.x
14-Sep-2011 14:27:21 org.openqa.jetty.util.FileResource <clinit>
INFO: Checking Resource aliases
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.servlet.WebApplicationHandler@41d05d
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started WebApplicationContext[/,/]
14-Sep-2011 14:27:22 org.openqa.jetty.http.SocketListener start
INFO: Started SocketListener on 0.0.0.0:4444
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.Server@8a0d5d
14-Sep-2011 14:27:27 org.openqa.grid.web.servlet.handler.RequestHandler handleNewSession
WARNING: WARNING : using a beforeSession on a proxy that can support multiple tests
is risky.
14-Sep-2011 14:27:37 org.openqa.grid.internal.RemoteProxy$CleanUpThread run
WARNING: session ext. key 1316006743657 has been ORPHANED and will be released
timing out ext. key 1316006743657

Client:

D:\>java -jar selenium-server-standalone-2.6.0.jar -role hub
14-Sep-2011 14:27:21 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
14-Sep-2011 14:27:21 org.openqa.jetty.http.HttpServer doStart
INFO: Version Jetty/5.1.x
14-Sep-2011 14:27:21 org.openqa.jetty.util.FileResource <clinit>
INFO: Checking Resource aliases
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.servlet.WebApplicationHandler@41d05d
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started WebApplicationContext[/,/]
14-Sep-2011 14:27:22 org.openqa.jetty.http.SocketListener start
INFO: Started SocketListener on 0.0.0.0:4444
14-Sep-2011 14:27:22 org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.Server@8a0d5d
14-Sep-2011 14:27:27 org.openqa.grid.web.servlet.handler.RequestHandler handleNewSession
WARNING: WARNING : using a beforeSession on a proxy that can support multiple tests
is risky.
14-Sep-2011 14:27:37 org.openqa.grid.internal.RemoteProxy$CleanUpThread run
WARNING: session ext. key 1316006743657 has been ORPHANED and will be released
timing out ext. key 1316006743657

The hub and client are on a different machines.

Reported by stan.wozniak on 2011-09-14 13:30:21

lukeis commented 8 years ago
Stan, the orphaned sessions is a separate issue. I have also seen this as reported in
issue 2175, however I was unable to reproduce it with the latest version. Please provide
any further information that may help us investigate this (os name/version, browser
name/version, etc) in issue 2175.

Also, it looks like you've pasted the same output for both server and client.

Reported by dave.hunt on 2011-09-14 13:41:00

lukeis commented 8 years ago
I have the same issue in the server 2.6.0:
HUB: java -Xms512m -jar selenium-server-standalone-2.6.0.jar -role hub -maxSession
400
CLIENTS:
java -Xms1024m -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://serverhost:4444/grid/register
-port 5558 -maxSession 150 -browser "browserName=htmlunit,maxInstances=150,platform=LINUX"

java -Xms1024m -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://serverhost:4444/grid/register
-port 5555 -maxSession 150 -browser "browserName=htmlunit,maxInstances=150,platform=LINUX"

java -Xms1024m -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://serverhost:4444/grid/register
-port 5556 -maxSession 150 -browser "browserName=htmlunit,maxInstances=150,platform=LINUX"

each client host is dedicated machine. I use TestNG and have the next exception in
results:
org.openqa.selenium.WebDriverException: Session [1316189175716] not available - [ext.
key 1316189238402, ext. key 1316189175706, ext. key 1316190075729, ext. key 1316189238404,
ext. key 1316189175707, ext. key 1316190075730, ext. key 1316189238403, ext. key 1316189175708,
ext. key 1316190075731, ext. key 1316189238405, ext. key 1316189175709, ext. key 1316190075732,
ext. key 1316189238406, ext. key 1316189175710, ext. key 1316190075733, ext. key 1316189238407,
ext. key 1316189175711, ext. key 1316190075734, ext. key 1316189238408, ext. key 1316189175712,
ext. key 1316190075736, ext. key 1316189238409, ext. key 1316189175713, ext. key 1316190075735,
ext. key 1316189238411, ext. key 1316189175714, ext. key 1316190075737, ext. key 1316189238410,
ext. key 1316189175715, ext. key 1316190075738, ext. key 1316189238412, ext. key 1316190075739,
ext. key 1316189238413, ext. key 1316189175717, ext. key 1316190075740, ext. key 1316189238414,
ext. key 1316189175718, ext. key 1316190075741, ext. key 1316189238415, ext. key 1316189175719,
ext. key 1316190075742, ext. key 1316189175720, ext. key 1316190075743, ext. key 1316189238417,
ext. key 1316190075744, ext. key 1316189238418, ext. key 1316189175722, ext. key 1316190075745,
ext. key 1316189238420, ext. key 1316189175723, ext. key 1316190075746, ext. key 1316189238419,
ext. key 1316189175724, ext. key 1316190075747, ext. key 1316189238421, ext. key 1316189175725,
ext. key 1316190075748, ext. key 1316189238422, ext. key 1316189175726, ext. key 1316190075749,
ext. key 1316189238423, ext. key 1316189175727, ext. key 1316190075750, ext. key 1316189238424,
ext. key 1316189175728, ext. key 1316190075751, ext. key 1316189238425, ext. key 1316189175729,
ext. key 1316190075752, ext. key 1316189238426, ext. key 1316189175730, ext. key 1316190075753,
ext. key 1316189238427, ext. key 1316189175731, ext. key 1316190075754, ext. key 1316189238428,
ext. key 1316189175732, ext. key 1316190075755, ext. key 1316189238429, ext. key 1316189175733,
ext. key 1316190075756, ext. key 1316189238430, ext. key 1316189175734, ext. key 1316190075757,
ext. key 1316189238431, ext. key 1316189175735, ext. key 1316190075758, ext. key 1316189238432,
ext. key 1316189175736, ext. key 1316190075759, ext. key 1316189238433, ext. key 1316189175737,
ext. key 1316190075760, ext. key 1316189238434, ext. key 1316189175738, ext. key 1316190075761,
ext. key 1316189238435, ext. key 1316189175739, ext. key 1316190075764, ext. key 1316189238443,
ext. key 1316189175740, ext. key 1316190075762, ext. key 1316189238436, ext. key 1316189175741,
ext. key 1316190075763, ext. key 1316189238437, ext. key 1316189175743, ext. key 1316190075765,
ext. key 1316189238439, ext. key 1316189175742, ext. key 1316190075766, ext. key 1316189238438,
ext. key 1316189175744, ext. key 1316190075767, ext. key 1316189238440, ext. key 1316189175746,
ext. key 1316190075768, ext. key 1316189238441, ext. key 1316189175745, ext. key 1316190075769,
ext. key 1316189238442, ext. key 1316189175747, ext. key 1316190075770, ext. key 1316189238444,
ext. key 1316189175752, ext. key 1316190075774, ext. key 1316189238448, ext. key 1316189175750,
ext. key 1316190075771, ext. key 1316189238445, ext. key 1316189175749, ext. key 1316190075772,
ext. key 1316189238446, ext. key 1316189175751, ext. key 1316190075773, ext. key 1316189238447,
ext. key 1316189175748, ext. key 1316190075775, ext. key 1316189238449, ext. key 1316189175758,
ext. key 1316190075778, ext. key 1316189238451, ext. key 1316189175761, ext. key 1316190075776,
ext. key 1316189238450, ext. key 1316189175753, ext. key 1316190075777, ext. key 1316189238454,
ext. key 1316189175754, ext. key 1316190075779, ext. key 1316189238453, ext. key 1316189175760,
ext. key 1316190075783, ext. key 1316189238452, ext. key 1316189175764, ext. key 1316190075781,
ext. key 1316189238455, ext. key 1316189175762, ext. key 1316190075780, ext. key 1316189238456,
ext. key 1316189175763, ext. key 1316190075782, ext. key 1316189238457, ext. key 1316189175765,
ext. key 1316190075784, ext. key 1316189238458, ext. key 1316189175766, ext. key 1316190075785,
ext. key 1316189238459, ext. key 1316189175755, ext. key 1316190075786, ext. key 1316189238460,
ext. key 1316189175757, ext. key 1316190075787, ext. key 1316189238462, ext. key 1316189175756,
ext. key 1316190075788, ext. key 1316189238461, ext. key 1316189175768, ext. key 1316190075789,
ext. key 1316189238463, ext. key 1316189175767, ext. key 1316190075790, ext. key 1316189238464,
ext. key 1316189175759, ext. key 1316190075791, ext. key 1316189238465, ext. key 1316189175769,
ext. key 1316190075792, ext. key 1316189238466, ext. key 1316189175770, ext. key 1316190075793,
ext. key 1316189238467, ext. key 1316189175771, ext. key 1316190075794, ext. key 1316189238468,
ext. key 1316189175772, ext. key 1316190075795, ext. key 1316189238469, ext. key 1316189175773,
ext. key 1316190075796, ext. key 1316189238470, ext. key 1316189175774, ext. key 1316190075797,
ext. key 1316189238471, ext. key 1316189175778, ext. key 1316190075798, ext. key 1316189238472,
ext. key 1316189175776, ext. key 1316190075800, ext. key 1316189238474, ext. key 1316189175775,
ext. key 1316190075799, ext. key 1316189238473, ext. key 1316189175777, ext. key 1316190075801,
ext. key 1316189238475, ext. key 1316189175779, ext. key 1316190075802, ext. key 1316189238476,
ext. key 1316189175780, ext. key 1316190075803, ext. key 1316189238477, ext. key 1316189175781,
ext. key 1316190075804, ext. key 1316189238478, ext. key 1316189175782, ext. key 1316190075805,
ext. key 1316189238479, ext. key 1316189175783, ext. key 1316190075806, ext. key 1316189238480,
ext. key 1316189175784, ext. key 1316190075807, ext. key 1316189238481, ext. key 1316189175785,
ext. key 1316190075808, ext. key 1316189238482, ext. key 1316189175786, ext. key 1316190075809,
ext. key 1316189238483, ext. key 1316189175787, ext. key 1316190075810, ext. key 1316189238484,
ext. key 1316189175788, ext. key 1316190075811, ext. key 1316189238485]
Build info: version: '2.4.0', revision: '13336', time: '2011-08-17 21:21:21'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version:
'1.6.0_26'
Driver info: driver.version: LoggingWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:131)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:105)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:407)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:169)
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:93)
    at $Proxy24.get(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver.get(EventFiringWebDriver.java:144)

Reported by dirzhov on 2011-09-16 16:45:16

lukeis commented 8 years ago
Reopened. Please report if the occurrences have decreased or increased with the release
of 2.6.0.

We have seen this drop to almost zero, however we did notice some occurrences whilst
modal security dialogs were present on the nodes (running Max OS X).

Reported by dave.hunt on 2011-09-16 20:58:23

lukeis commented 8 years ago
For me occurrences have decreased. 2.5 version used to fail 10/10 times. 2.6 fails 6/10
times. Error message that I see is:

     [java] Caused by: org.openqa.selenium.WebDriverException: Session [1316623164372]
not available - []; duration or timeout: 3 milliseconds
     [java] Build info: version: '2.6.0', revision: '13840', time: '2011-09-13 14:55:30'
     [java] System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-32-generic',
java.version: '1.6.0_24'
     [java] Driver info: driver.version: RemoteWebDriver
     [java]     at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source)
     [java]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     [java]     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     [java]     at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)
     [java]     at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)
     [java]     at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:397)
     [java]     at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:401)
     [java]     at org.openqa.selenium.remote.RemoteWebDriver.getTitle(RemoteWebDriver.java:160)
     [java]     at org.openqa.selenium.internal.seleniumemulation.GetTitle.handleSeleneseCommand(GetTitle.java:25)
     [java]     at org.openqa.selenium.internal.seleniumemulation.GetTitle.handleSeleneseCommand(GetTitle.java:1)
     [java]     at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:30)
     [java]     ... 18 more

Reported by anandj82 on 2011-09-22 01:31:00

lukeis commented 8 years ago
when you add an example of this failure, can you also add the command that triggered
it ?

Reported by francois.reynaud on 2011-09-22 08:34:06

lukeis commented 8 years ago
I scanned through all the failures in build. I could see the above exception happening
while executing 3 commands

1. DefaultSelenium.getTitle()
2. DefaultSelenium.getHTMLSource()
3. Webdriver.getScreenshotAs()

In my tests, all these commands would get executed when a test fails. 

At the end of test execution, I can see few tests hanging. If I login to VM at that
time, I can see a FF browser open but the page never loads. The last command that got
executed in that node would be - deleteSession. After waiting for a while, test would
fail and try to execute the onFailure commands given above. Then it throws session
not available exception.

I don't know why the page doesn't load once in a while. It is certainly not a problem
with the application I am testing.

Reported by anandj82 on 2011-09-22 15:52:10

lukeis commented 8 years ago
anand; Which firefox version are you running ?

Reported by kristian.rosenvold@zenior.no on 2011-09-22 20:01:17

lukeis commented 8 years ago
Its 3.6.18

Reported by anandj82 on 2011-09-22 20:07:33

lukeis commented 8 years ago
To Dave and others who are not getting this issue - Which version of Firefox are you
using? I would like to know whether this issue will be fixed by upgrading the FF browser
version

Reported by anandj82 on 2011-09-23 15:56:22

lukeis commented 8 years ago
We are still occasionally get this issue with Firefox 6/7. It sometimes seems to be
related to modal dialogs in Firefox or on the OS, and I am suspicious that it may be
due to a timeout launching the browser. Is there a way to configure this particular
timeout?

Reported by dave.hunt on 2011-09-23 16:09:02

lukeis commented 8 years ago
Let me try to make this clear; anand - I think you might be running into some version
of Issue 2456, which has been fixed on 2.7 (There may be several other combinations
of event causing hangs on "get" with ff3.x and they should all be fixed now).

This should mean the browser is hanging on "get" and the session eventually gets orphaned.
It should be possible to reproduce this using the unit test that I added when fixing
Issue 2456.  There seems to be a common "trait" to this that there is a hanging browser
window, which can be recreated with a temp revert of r13876

Reported by kristian.rosenvold on 2011-09-23 16:36:31

lukeis commented 8 years ago
Issue 2456 is exactly what I also saw. If I refresh the browser while its hanging then
the test was completing successfully. 

I will take the latest from repository and run the tests again.

Reported by anandj82 on 2011-09-23 18:53:25

lukeis commented 8 years ago
Even after taking the latest from repository, I am still getting the same error.

Reported by anandj82 on 2011-09-26 00:28:04

lukeis commented 8 years ago
Update on tests with 2.7 version - 

1. Upgrading to Firefox 6.0 increased the frequency of this failure for my tests. I
am running the tests on 64 bit Ubuntu VMs. These tests were using webdriverbackedselenium.
Grid was setup with WD nodes.

2. I moved back to selenium from webdriverbackedselenium and started the grid with
rc nodes rather than wd nodes. That is working perfect. No timeouts or session issues.

Reported by anandj82 on 2011-09-28 18:34:08

lukeis commented 8 years ago
We upgraded to Selenium 2.7.0 Grid and WebDriver today and the "Session [...] not available"
errors continue.

Reported by rschulz@sonic.net on 2011-09-29 00:32:40

lukeis commented 8 years ago
I am having the same issue.  

Hub:

java -jar selenium-server-standalone-2.7.0.jar -role hub

Client:

java -jar selenium-server-standalone-2.7.0.jar -role remotecontrol -port 5555 -hubHost
<server> -hubPort 4444

Browser: Firefox
Browser Version: 6.0.2
Hub OS: 64 bit Ubuntu VM 10.04
Client OS: 64 bit Ubuntu 11.04

my test is failing on "sel.open(<url>)".  Interestingly, the test passes on the first
run, then will fail on any subsequent runs launched soon (within 0-60 seconds) after
the first is complete.

This is the first part of my test:

from selenium import selenium
import unittest, time, re

class test_simple_sanity(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("<server>", 4444, "*firefox", "<site under test>")
        self.selenium.start()

    def test_test_simple_sanity(self):
        sel = self.selenium
        sel.open("<index of main page>")

then:

======================================================================
ERROR: test_test_simple_sanity (test_simple_sanity.test_simple_sanity)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<PATH_TO_TEST>/test_simple_sanity.py", line 12, in test_test_simple_sanity
    sel.open("/transfer/index.html")
  File "/usr/local/lib/python2.6/dist-packages/selenium/selenium.py", line 777, in
open
    self.do_command("open", [url,ignoreResponseCode])
  File "/usr/local/lib/python2.6/dist-packages/selenium/selenium.py", line 217, in
do_command
    raise Exception, data
Exception: <html>
<head>
<title>Error 500 org.openqa.grid.internal.GridException: Session [ac3d6c303e244bbdbc1e596bc32955fd]
not available - [8f0f1109-c4f6-4f77-bf68-eb7823c78fc4 (int. key, remote not contacted
yet.)]</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2><pre>org.openqa.grid.internal.GridException: Session [ac3d6c303e244bbdbc1e596bc32955fd]
not available - [8f0f1109-c4f6-4f77-bf68-eb7823c78fc4 (int. key, remote not contacted
yet.)]</pre>
<p>RequestURI=/selenium-server/driver/</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>

Reported by bmannix on 2011-09-29 14:50:29

lukeis commented 8 years ago
I'm curious if the manifestation of this problem is uniformly distributed? It is so
common for us as to be a very serious impediment to testing. I gather that's not so
for everyone?

Reported by rschulz@sonic.net on 2011-09-30 22:37:58

lukeis commented 8 years ago
Those of you experiencing orphaned sessions should consider pacing the startup of the
browsers a little, maybe wait a second between each browser; I have a very definite
problem with the orphaning algorithm that I will fix for 2.10

Reported by kristian.rosenvold on 2011-10-21 12:05:54

lukeis commented 8 years ago
@kristian, is this wait ONLY for orphaning issues? Or will it fix the session not found
issue also?

Reported by anandj82 on 2011-10-21 21:03:10

lukeis commented 8 years ago
Hi 
I have session issue with selenium 2.12.0 as well.I'm running tests on windows7 machine
on IE8 browser.
Timeout is not really releasing the session when some cofirmation dialog appears with
controls ok or cancel while closing the browser. I could reproduce this issue when
I make a javacsript call with in the test case but once I comment javascript code the
tests fails and releases the session though I see a confirmation dialog. I will have
manually click ok button in order to release the session so that it can pick the next
test case.Please help us to resolve this issue is it possible to look for dialog prompts
and close them as well before we close/quit the browser? Here ate the log I captured
during the tests

Nov 15, 2011 10:20:42 AM org.openqa.grid.internal.RemoteProxy$CleanUpThread run
WARNING: session ext. key 1321310892293 has TIMED OUT and will be released
Nov 15, 2011 10:49:31 AM org.openqa.grid.web.servlet.handler.RequestHandler getS
ession
WARNING: Cannot find session 1321310892293 in the registry.
Nov 15, 2011 10:49:31 AM org.openqa.grid.web.servlet.handler.RequestHandler getS
ession
WARNING: Cannot find session 1321310892293 in the registry.
Nov 15, 2011 10:49:31 AM org.openqa.grid.web.servlet.handler.RequestHandler getS
ession

Reported by nkalakonda on 2011-11-15 17:25:37

lukeis commented 8 years ago
Still seeing this issue in 2.12.0

Logs can be found at the following locations.
 * Build: https://gist.github.com/1373221#file_build.log
 * Hub: https://gist.github.com/1373221#file_hub.log
 * Node: https://gist.github.com/1373221#file_node.log

To me it looks as though the session ID is being returned to the client before being
added to the hub registry.

This was replicated whilst running 5 instances of Firefox in parallel. I'm going to
see if I can replicate it when running just a single instance of Firefox.

Reported by dave.hunt on 2011-11-17 14:37:23

lukeis commented 8 years ago
http://www.google.com/codesearch#2tHw6m3DZzo/trunk/java/server/src/org/openqa/grid/web/servlet/handler/RequestHandler.java&q=RequestHandler%20package:http://selenium%5C.googlecode%5C.com&l=193

the hub is updated only after everything has been forwarded already. Should be done
before.

François

Reported by francois.reynaud on 2011-11-17 16:12:49

lukeis commented 8 years ago
I'm not sure if I am seeing the same thing, but there is definitely still something
wrong with grid 2.14.0 and running suites of tests via testNG (but I do not think it
is testNG).

I have a suite of tests, if I run them in parallel (4 nodes) they fail all the time
with various problems from missing elements to stale element exception to time outs.

If I restrict all the tests to only one thread all pass, also if I have 2 threads that
go to different URL's then all pass.

Now the conclusion I have drawn (although not 100% sure) is that there seems to be
some kind link between session and URL when running in parallel which causes the commands
to get lost..

Reported by jimusbobus on 2011-11-30 16:25:38

lukeis commented 8 years ago
Those of you seeing "Session not available" messages /must/ try grid 2.14.0 or higher.

This will print a message in the form of "Client requested session " + keyId + " that
was terminated due to " + somereason. This "reason" will tell us /why/ the session
is not available. There are a number of possible reasons,  the possible values ar 
       TIMEOUT,
ORPHAN,
CLIENT_STOPPED_SESSION,
FORWARDINGFAILED,
CREATIONFAILED,
PROXY_REREGISTRATION

Reported by kristian.rosenvold@zenior.no on 2011-11-30 20:01:50

lukeis commented 8 years ago
@freynaud @nvidrum Comment #14 looks like the runaway session cleaner in remoteproxy
that we've been talking about.

#45: Can you please tell us if your tests work if you bypass the hub and run parallel
directly towards a node with for instance 4 threads ? Please also confirm that both
your clients, your hub and your nodes are running 2.14.0

Reported by kristian.rosenvold@zenior.no on 2011-11-30 20:05:53

lukeis commented 8 years ago
my entire system was upgraded to 2.14.0, grid, nodes and client, i guess i just use
the node URL instead of the hub URL to bypass.

Reported by jimusbobus on 2011-12-01 09:48:11

lukeis commented 8 years ago
I hope this explains things, let me know if you need more.

Test1 - local test
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new FirefoxDriver(capabilities);
driver.manage().window().setSize(new Dimension(1280, 800));
driver.get(targetURL);

Test2 - test against a grid node
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new RemoteWebDriver(new URL("gridNode"), capabilities);
driver.manage().window().setSize(new Dimension(1280, 800));
driver.get(targetURL);

Test3 - test against the grid
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new RemoteWebDriver(new URL("gridHub"), capabilities);
driver.manage().window().setSize(new Dimension(1280, 800));
driver.get(targetURL);

Testcase1 - All tests were performed with a simple test case that just logged onto
a web app.

A - 1 thread 1 class - All three tests pass
B - 1 thread 3 differrent classes - Test1 and Test2 pass - Test3;
session ext. key 1322764776981 has TIMED OUT and will be released

C - 3 thread 3 differrent classes - Test1 passed - Test2 (occasional fails) and Test3
failed if no nodes not released yet, pass if they are released checking against (http://10.14.0.7:4444/grid/console?config=true&configDebug=true)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="3" name="Parallel Test" parallel="tests" verbose="2">
  <test name="Simple Appliance Logon" preserve-order="true">
    <parameter name="propertyFile" value="test1.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest"/>
    </classes>
  </test>
  <test name="Simple Appliance Logon2" preserve-order="true">
    <parameter name="propertyFile" value="test2.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest1"/>
    </classes>
  </test>
  <test name="Simple Appliance Logon3" preserve-order="true">
    <parameter name="propertyFile" value="test3.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest2"/>
    </classes>
  </test>
</suite>

13:39:20.218 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764776998
13:40:25.220 WARN [22] org.openqa.grid.internal.RemoteProxy - session ext. key 1322764776999
has TIMED OUT and will be released
13:40:26.930 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764776999
13:40:26.931 WARN [22] org.openqa.grid.internal.RemoteProxy - session ext. key 1322764777000
has TIMED OUT and will be released
13:40:28.487 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764777000
13:40:33.489 WARN [22] org.openqa.grid.internal.RemoteProxy - session ext. key 1322764777001
has TIMED OUT and will be released
13:40:35.152 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764777001
13:41:45.155 WARN [22] org.openqa.grid.internal.RemoteProxy - session ext. key 1322764777002
has TIMED OUT and will be released
13:41:46.843 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764777002
13:41:51.844 WARN [22] org.openqa.grid.internal.RemoteProxy - session ext. key 1322764777003
has TIMED OUT and will be released
13:41:53.552 WARN [22] org.openqa.grid.selenium.proxy.DefaultRemoteProxy - Error releasing
the resources on timeout for session ext. key 1322764777003

D - 3 thread 3 identical classes - All three tests fail

by this i mean 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="3" name="Parallel Test" parallel="tests" verbose="2">
  <test name="Simple Appliance Logon" preserve-order="true">
    <parameter name="propertyFile" value="test1.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest"/>
    </classes>
  </test>
  <test name="Simple Appliance Logon2" preserve-order="true">
    <parameter name="propertyFile" value="test2.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest"/>
    </classes>
  </test>
  <test name="Simple Appliance Logon3" preserve-order="true">
    <parameter name="propertyFile" value="test3.properties"/>
    <classes>
      <class name="selenium.appliance.smoketest.SimpleApplianceLogonTest"/>
    </classes>
  </test>
</suite>

Reported by jimusbobus on 2011-12-01 13:53:24

lukeis commented 8 years ago
I have similar issues with selenium 2.14: I 've got those "Session not found" and SocketExceptions
(WindowsXP and Firefox 8).
 As an attachment I have to JAVA examples. The first is a multithread example and I
don't know why I always get those errors. The second multisession example works always
but is not really suitable (maybe suitable when I try to use HashMaps and my own browserID).

Reported by schullerer on 2011-12-03 16:21:51


lukeis commented 8 years ago
@kristian.rosenvold@zenior.no where do you expect the message to be shown? RC or Hub
console?

Reported by anandj82 on 2011-12-05 19:00:48

lukeis commented 8 years ago
After upgrading to 2.14, I could see the following extra message in the error

    <head>
     <title>Error 500 java.lang.reflect.InvocationTargetException</title>
     </head>
     <body>
     <h2>HTTP ERROR: 500</h2><pre>java.lang.reflect.InvocationTargetException</pre>
     <p>RequestURI=/wd/hub/session/1323192132284/title</p>
     <p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>

     </body>
     </html>

Reported by anandj82 on 2011-12-06 20:35:09