Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure

We have configured the test project agent using docker-compose. But we are facing an issue while running some jobs.

For some tests, it shows the following error,

Failed to execute test ‘For date provisions [IU20-590]’ on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Here is the docker-compose.yml file,

version: "3.1"
services:
  testproject-agent:
    image: testproject/agent:latest
    container_name: testproject-agent
    depends_on:
      - chrome
      - firefox
    volumes:
      - testproject:/var/testproject/agent
    environment:
      TP_API_KEY: "<API_KEY>"
      TP_AGENT_ALIAS: "local-docker-agent"
      CHROME: "chrome:4444"
      FIREFOX: "firefox:4444"
    ports:
      - "8585:8585"
  chrome:
    image: selenium/standalone-chrome
    volumes:
      - /dev/shm:/dev/shm
  firefox:
    image: selenium/standalone-firefox
    volumes:
      - /dev/shm:/dev/shm

volumes:
  testproject:

Here are the logs from agent,

2022-08-18 18:45:05.389 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-7 i.t.a.m.d.k                              Step #16/1 'Run Test {{Logout - End of tests}}' in Test 'For date provisions [IU20-590]' on '{}' --> Started
2022-08-18 18:45:05.389 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-7 i.t.a.m.d.k                              Step #16/1 'Run Test {{Logout - End of tests}}' in Test 'For date provisions [IU20-590]' <-- Finished: Skipped (Previous step caused Test failure.)
2022-08-18 18:45:05.389 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #16 in Test 'For date provisions [IU20-590]' <-- Finished: None ()
2022-08-18 18:45:05.390 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.t                              Finished executing Test 'For date provisions [IU20-590]': Failed
2022-08-18 18:45:05.390 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.i                              RestartDriver flag is on, closing session... 
2022-08-18 18:45:05.480 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.i                              Chrome Driver is not initialized.
2022-08-18 18:45:05.480 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.d                              Initializing driver Chrome...
2022-08-18 18:45:05.481 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.d                              Chrome will be launched in headless mode
2022-08-18 18:45:06.111 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-4-thread-1 i.t.a.m.d.k                              Reporting execution progress to manager
2022-08-18 18:45:06.112 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-4-thread-1 i.t.a.e.a                                Reporting progress to Agent Manager...
2022-08-18 18:48:05.499 mLsND3tWlEiq3hNPZBPExw_5  ERROR pool-3-thread-3 i.t.a.m.d.i                              Failed to initialize Chrome driver
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
  at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:230)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:151)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:138)
  at io.testproject.agent.managers.d.d.a(TestProjectAgent:2868)
  at io.testproject.agent.managers.d.i.b(TestProjectAgent:331)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:324)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:447)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:1159)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:778)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:637)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
  at io.testproject.agent.c.d.run(TestProjectAgent:33)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '59c91732128f', ip: '172.28.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-17-cloud-amd64', java.version: '13-ea'
Driver info: driver.version: RemoteWebDriver
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:72)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$6(RetryRequest.java:83)
  at net.jodah.failsafe.Functions.lambda$get$0(Functions.java:48)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.Execution.executeSync(Execution.java:128)
  at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:379)
  at net.jodah.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:68)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$7(RetryRequest.java:83)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:51)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$6(RetryRequest.java:83)
  at net.jodah.failsafe.Functions.lambda$get$0(Functions.java:48)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.Execution.executeSync(Execution.java:128)
  at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:379)
  at net.jodah.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:68)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$7(RetryRequest.java:83)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:110)
  at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
  at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
  at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
  ... 15 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
  at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1957)
  at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2092)
  at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:66)
  ... 46 common frames omitted
2022-08-18 18:48:05.501 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Test #5 'For date provisions [IU20-590]' (gH9F2GRpO02XMiJkKivstg) execution on 'Chrome' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.502 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #1 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.502 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #2 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.503 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #3 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.503 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #4 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.504 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #5 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.504 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #6 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.505 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #7 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.505 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #8 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.505 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #9 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.506 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #10 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.506 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #11 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.507 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #12 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.507 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #13 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.507 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #14 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.508 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #15 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.508 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Step #16 in Test 'For date provisions [IU20-590]' <-- Finished: Error (Failed to execute test 'For date provisions [IU20-590]' on Chrome: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.)
2022-08-18 18:48:05.509 mLsND3tWlEiq3hNPZBPExw_5  ERROR pool-3-thread-3 i.t.a.m.d.i                              Failed to execute test gH9F2GRpO02XMiJkKivstg on Chrome
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
  at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:230)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:151)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:138)
  at io.testproject.agent.managers.d.d.a(TestProjectAgent:2868)
  at io.testproject.agent.managers.d.i.b(TestProjectAgent:331)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:324)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:447)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:1159)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:778)
  at io.testproject.agent.managers.d.i.a(TestProjectAgent:637)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
  at io.testproject.agent.c.d.run(TestProjectAgent:33)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '59c91732128f', ip: '172.28.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-17-cloud-amd64', java.version: '13-ea'
Driver info: driver.version: RemoteWebDriver
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:72)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$6(RetryRequest.java:83)
  at net.jodah.failsafe.Functions.lambda$get$0(Functions.java:48)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.Execution.executeSync(Execution.java:128)
  at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:379)
  at net.jodah.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:68)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$7(RetryRequest.java:83)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:51)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$6(RetryRequest.java:83)
  at net.jodah.failsafe.Functions.lambda$get$0(Functions.java:48)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:66)
  at net.jodah.failsafe.Execution.executeSync(Execution.java:128)
  at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:379)
  at net.jodah.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:68)
  at org.openqa.selenium.remote.http.RetryRequest.lambda$apply$7(RetryRequest.java:83)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:110)
  at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
  at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
  at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
  ... 15 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
  at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1957)
  at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2092)
  at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:66)
  ... 46 common frames omitted
2022-08-18 18:48:05.510 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.i                              RestartDriver flag is on, closing session... 
2022-08-18 18:48:05.511 mLsND3tWlEiq3hNPZBPExw_5  INFO  pool-3-thread-3 i.t.a.m.d.k                              Target 'Chrome (Headless) 104.0.5112.79' execution <-- Finished: Passed ()
2022-08-18 18:48:05.513 mLsND3tWlEiq3hNPZBPExw_5  INFO  execute-state   i.t.a.m.d.k                              Job '(temporary)' execution <-- Finished: null ()