0

I have set up the selenium grid 4 in ECS fargate POC. The setup works fine and ran a few tests but I'm facing an issue with the node sessions. I am passing the environment variable to increase the session but the changes are not reflecting in the fargate setup. Can anyone let me know what will be the issue?

Note: I have run the same setup in my local machine (docker-compose) it works as expected in the local machine.

=========== UPDATED

I have attached the screenshots of the selenium landing page. Which has a chrome node with one session after passing the SE_NODE_MAX_SESSIONS=2. The logs of chrome node. Running tasks and chrome task details.

start the grid? I first start the gird hub ECS service wait till running state and then start the chrome ECS service. I have tried running manually and using the run-task to override the environment variables.

cpu and memory details? For both grid hub and chrome task, I have set up 4GB memory and 2vCPUs.

landing page ecs tasks chrome details chrome logs

  • I am coming to this with a better Fargate than Selenium understanding and, with that background, I am unclear what you would expect to happen and what you actually see happening (from a Fargate perspective). Care to expand a bit? Unless there is a Selenium expert that can solve this right away. – mreferre Mar 22 '21 at 09:35
  • @mreferre I want to increase the node max session for a browser. This can be done by using the SE_NODE_MAX_SESSIONS=4 environment variable. eg: when I set this value I was able to get 4 sessions of chrome in my local machine. The same environment var used in my fargate I get the default value 1 session. – Manu Prathapan Mar 22 '21 at 16:21
  • And are you passing the environment variable either in the ECS task definition or at run-time when you launch the task? – mreferre Mar 22 '21 at 18:55
  • @mreferre I have passed the environment in task definition and at run time. I tried both ways. I have updated the question with more details. Please look into it and let me know if I'm doing anything wrong. – Manu Prathapan Mar 23 '21 at 07:54
  • Interesting. You are passing the variable and apparently it gets picked up in the container because I see it spits `max-sessions=2` in the log. So that part should be ok. Is there something else that needs to be set to get the 2 sessions you want? Perhaps that variable sets the ceiling but you need to tell Selenium how many you actually want somewhere? Did you say the SAME config works on prem just fine and you get the 2 sessions automatically? Sorry just brainstorming here. – mreferre Mar 23 '21 at 12:05
  • yes, the same configuration works in my local machine. I have previously set up selenium grid v3 which works perfectly. the same setup should also run selenium grid v4 only the env variables changes. as per my knowledge, there should not be any other changes. – Manu Prathapan Mar 23 '21 at 13:54

2 Answers2

1

I am running into the same issue. I wanted to have sessions set to 4, while ECS service had 1vCPus. This was not possible to setup, up to the latest selenium version.

Selenium team have released a fix here.

I tried this out with environment variables:

  • SE_NODE_MAX_SESSIONS=4
  • SE_NODE_OVERRIDE_MAX_SESSIONS=true

Locally it works, but in ECS, although max sessions is set 4 from what I see in logs, I still see one available session when doing curl check.

I could confirm that by checking grid status:

curl -X POST -H "Content-Type: application/json" --data '{"query": "{ grid { totalSlots, sessionCount } }"}' -s my-selenium-machine:4444/graphql

For one selenium node, I should have 4 slots, and I have 1. Were you able to resolve the issue? Does it work for you in latest selenium version?

UPDATE

I was able to resolve this issue with adding of additional environment variable:

  • JAVA_OPTS=-XX:ActiveProcessorCount=4
ibalosh
  • 135
  • 6
0

I resolved it by referring this issue on the Github: https://github.com/SeleniumHQ/selenium/issues/8974, you should set the active processors as well besides setting max sessions on your node.

XX:ActiveProcessorCount=**

** is your preferred max sessions. Hope it works for you!

Alex
  • 1
  • Hi Alex, thank you for the details! I was able to use that in Amazon ECS with following Environment variable: JAVA_OPTS=-XX:ActiveProcessorCount=** – ibalosh Apr 21 '21 at 14:52