Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session [(null externalkey)] not available and is not among the last 1000 terminated sessions. #7677

Closed
ericomurtez opened this issue Jan 10, 2017 · 16 comments

Comments

@ericomurtez
Copy link

The problem

This was working for me and I updated everything on the environment and now I cannot run a test successfully.

Every time I start a test, the chrome (or safari) will start on the device then the test will fail with error. This only happens when I run a test through the grid, if I point straight to node there are no issues. I can also run desktop browser tests through same node, so I dont think it is a grid issues.

Seems to me that the session is being created but as soon as that happens, the grid loses the session and gives error, but the node is waiting for the grid to send it commands.

Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.
Active sessions are[ext. key 7376a1ec-40b9-4d9d-9860-138ca24a3b3a] (org.openqa.grid.common.exception.GridException) (Selenium::WebDriver::Error::UnknownError)

The node and grid continue for 30 seconds until the session times out.

Grid gives message after timeout
WARN - session ext. key 7376a1ec-40b9-4d9d-9860-138ca24a3b3a has TIMED OUT due to client inactivity and will be released.

Environment

  • 1.6.3

Latest version of everything.

Appium logs
https://gist.github.com/ericomurtez/b521115568036d25cb5e9941ca5016b3

Grid logs.
14:27:19.283 INFO - Launching Selenium Grid hub
2017-01-10 14:27:20.159:INFO::main: Logging initialized @1069ms
14:27:20.177 INFO - Will listen on 4444
14:27:20.245 INFO - Will listen on 4444
2017-01-10 14:27:20.252:INFO:osjs.Server:main: jetty-9.2.z-SNAPSHOT
2017-01-10 14:27:20.289:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@32eebfca{/,null,AVAILABLE}
2017-01-10 14:27:20.335:INFO:osjs.ServerConnector:main: Started ServerConnector@6ec8211c{HTTP/1.1}{0.0.0.0:4444}
2017-01-10 14:27:20.336:INFO:osjs.Server:main: Started @1246ms
14:27:20.337 INFO - Nodes should register to http://192.168.56.1:4444/grid/register/
14:27:20.337 INFO - Selenium Grid hub is up and running
14:27:34.779 INFO - Got a request to create a new session: Capabilities [{rotatable=false, nativeEvents=false, newCommandTimeout=300, platformVersion=6.0, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=android, version=, deviceName=0715f7c4c56a0b36, platform=ANY, cssSelectorsEnabled=true}]
14:27:35.340 INFO - Registered a node http://localhost:4801
14:27:43.314 INFO - Got a request to create a new session: Capabilities [{rotatable=false, nativeEvents=false, newCommandTimeout=300, platformVersion=6.0, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=android, version=, deviceName=0715f7c4c56a0b36, platform=ANY, cssSelectorsEnabled=true}]
14:27:43.316 INFO - Available nodes: [http://localhost:4801]
14:27:43.316 INFO - Trying to create a new session on node http://localhost:4801
14:27:43.316 INFO - Trying to create a new session on test slot {browserName=chrome, maxInstances=1, version=6.0, deviceName=0715f7c4c56a0b36, platform=ANDROID}
14:28:29.400 WARN - session ext. key 9c446ca2-3d59-4e26-ab23-285fb48b3353 has TIMED OUT due to client inactivity and will be released.

@triager triager added the Needs Triage bugs which are not yet confirmed label Jan 10, 2017
@dpgraham
Copy link
Contributor

What happens if you run the appium tests locally without using Grid?

@ericomurtez
Copy link
Author

They will run fine.
But what makes me think it is appium related is that if I have chrome desktop browser nodes on the grid there are no issues.

@PavithraNavaneeth
Copy link
Contributor

Is there any solution yet for this?
I have the similar issue for my android native app test while using appium 1.6.3 on grid. But in my case it is specific to parallel runs of android emulators. If I run the test in sequential (on grid emulators) it works fine but while trying to run in parallel it throws me the same error.

@ericomurtez
Copy link
Author

Nope still have not figured it out

@jlipps
Copy link
Member

jlipps commented Jan 31, 2017

@ericomurtez nothing looks off in the Appium logs. Session is created and no commands come in from the client. You may need to increase your grid-level timeout. 45 seconds is often not enough time for an Appium session to start.

@ericomurtez
Copy link
Author

Thanks @jlipps, appreciate you looking.

@ericomurtez
Copy link
Author

For anybody stuck on this, I downgraded to selenium 2.53.1 and downgraded my appium Lib to 8.0 and it worked.

@mstankovic86
Copy link

facing the same issue after switching on selenium 3.0.1
I think this is not an Appium bug but selenium - since I'm reproducing issue using grid and chrome browser. After first test my node got stuck on hub. It's marked as busy but no tests are running on it.

After 2 days debugging I found this: some timeouts are changed from ms into seconds, so double check those timeouts.

concretely, my problem was in browserTimeout, timeout and newSessionWaitTimeout.

@gerich-home
Copy link

Still getting the same issue on the latest docker hub images (version 3.3.0).

My docker-compose.yml file looks like:

version: '2'
services:
  node-firefox:
    environment:
      HUB_PORT_4444_TCP_ADDR: hub
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/node-firefox
    links:
    - 'hub:'
  node-chrome:
    environment:
      HUB_PORT_4444_TCP_ADDR: hub
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/node-chrome
    links:
    - 'hub:'
  hub:
    ports:
    - 4444:4444/tcp
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/hub

Adding specific tags to it fixes the issue:

version: '2'
services:
  node-firefox:
    environment:
      HUB_PORT_4444_TCP_ADDR: hub
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/node-firefox:2.53.1
    links:
    - 'hub:'
  node-chrome:
    environment:
      HUB_PORT_4444_TCP_ADDR: hub
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/node-chrome:2.53.1
    links:
    - 'hub:'
  hub:
    ports:
    - 4444:4444/tcp
    labels:
      io.rancher.container.pull_image: always
    tty: true
    image: selenium/hub:2.53.1

@jlipps
Copy link
Member

jlipps commented Apr 13, 2017

Looks indeed like a grid-level timeout issue based on @mstankovic86's findings.

@KazuCocoa
Copy link
Member

concretely, my problem was in browserTimeout, timeout and newSessionWaitTimeout.

SeleniumHQ/selenium#3071

@imurchie imurchie removed the Needs Triage bugs which are not yet confirmed label Jul 13, 2017
@kyxap
Copy link

kyxap commented Jan 25, 2018

Reproduced with Grid + IE:
org.openqa.selenium.WebDriverException: Session [null] not available and is not among the last 1000 terminated sessions.
Configuration:
selenium-server-standalone-3.8.1 + IEDriverServer_3.8.0.exe x64 + org.jenkins-ci.plugins:selenium:3.7.1

@gohelkiran
Copy link

I have same problem with latest version of selenium 3.9.0 with Grid environment
Firefox, chrome works proper but not working with IE driver

@gohelkiran
Copy link

same issue with selenium version 3.11 and 3.12 anyone having solution to this problem?

@saigovindu
Copy link
Contributor

Yes i have the same issue with selenium 3.12 but it is working in selenium 3.6

@rafaelstalder
Copy link

I have experienced the same issue with Selenium 3.141.59. Downgraded to 3.6 and it works now. Why is this issue closed? It is not working for newer versions than 3.6 so imho it needs to be fixed.

Please open this issue again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests