1
votes

Primary purpose is to run multiple chrome browsers(9 browsers) in a single container.

I have a hub & node setup with containers having multiple browsers to run in a single chrome node container. I have created two containers with the below docker commands :

To create a hub container : docker run -d -p 4445:4444 --name selenium_hub selenium/hub

To create node container and link it to the hub : docker run -v /dev/shm:/dev/shm -d -p 6001:5900 -p 7001:5555 -e NODE_MAX_INSTANCES=7 --name chrome_6 --link selenium_hub:hub selenium/node-chrome-debug

The problem is when i run my test cases in a single container by launching multiple chrome browsers simultaneously(9 browsers), test cases get executes for a while then browsers start crashing one by one.

I have tried docker logs of container, but couldn't able to find the actual cause for the issue.

Can someone guide me on this? How to debug this scenario? Is there anyone faced similar issue and fixed it?

1
Can you add some of the log output? Is is possible that you run out of memory?sauerburger

1 Answers

1
votes

The main reason of the Chrome Browsers crashing one by one is relates to the Hypertext Transfer Protocol -- HTTP/1.1

In Section 8.1.4 - Connections of RFC2616 it is mentioned that a single-user client can maintain maximum 2 connections with any server or proxy. Where as a proxy can use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines were intended to improve HTTP response times and avoid congestion.

Having said that, it is worth to mention that the modern browsers are less restrictive than this, allowing a larger number of connections. The RFC2616 does not specify how to prevent the limit being exceeded. Either connections can be blocked from opening or existing connections can be closed.

An example from this site speaks about the following limitation :

  • Internet Explorer 7.0 : 2
  • Internet Explorer 8.0 and 9.0 : 6
  • Internet Explorer 10.0 : 8
  • Internet Explorer 11.0 : 13
  • Firefox : 6
  • Chrome : 6
  • Safari : 6
  • Opera : 6
  • iOS : 6
  • Android : 6

Solution

A viable solution seems to restrict the number of concurrent persistent connections to 6.

You can find another way to increase the number of persistent connections through creating sub-domains modifying the hosts file as per the discussion Selenium grid sessions not applied