-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[🐛 Bug]: On grid, session is started but never used #11881
Comments
@bhecquet, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
I've got a similar issue. 5 concurrent tests, each test has a 200 second delay.
To avoid the timeout, I add the following configuration
result: 4 tests PASSED, no response is received for the 5th test and the test suite never completes All our test suites that use concurrent tests are affected by timeout issues: |
An other information that may help to resolve this bug: if I remove the "--session-request-timeout 30" parameter from hub, I don't have the bug anymore. |
I do not see the issue. There are three timeouts into play here:
@bhecquet I recommend to check the different flags for configuration here https://www.selenium.dev/documentation/grid/configuration/cli_options/, also the first steps here https://www.selenium.dev/documentation/grid/getting_started/ If you have more questions, I will leave some links below you can use to join our user chat community. |
💬 Please ask questions at:
|
Hello, thanks for your reply. |
The reason is the same, you need to figure out what timeouts work for you. If the client times out before the queue times out, then you will have orphan sessions. That is why we left it configurable and not hard coded. |
So I do not understand why I get a staled session on the node, corresponding to a client request which has already timeout (after 30 secs only). Tell me if I understand correctly the process:
Is there a moment where session is still in session queue and also created on node ? |
That seems correct, but what you are seeing:
is because the session request was in the queue for over 30 seconds and no Node slot was released in the meantime. |
Yes, I agree with that, but, in my test code (provided in the issue) I set a custom capability ("cs:test<some_id>") that help me identify which session is currently started on node, and what I observe is:
That's what surprise me |
I do not think you can correlate that because you are executing a loop, 10 times, for each test. So you do not have a single request with |
I looked at the "LocalNewSessionQueue" code and see that while distributor takes effectively the session request to create it, it's removed from the queue, so theorically, what I observe is not possible :( I will do more tests to understand better what happens and let you know Thanks for your time |
Hello @diemol I think I've found the root cause of my problem and it's in LocalNewSessionQueue class In fact, when session request arrives, a wait is performed selenium/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java Line 199 in 440a388
During this wait, LocalDistributor calls selenium/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java Line 304 in 440a388
to get sessions in queue But nothing prevents the session request to timeout while the session is being created I've added more logs to grid code (whole file attached)
You can look at the modified code (logs added) here: https://github.com/bhecquet/selenium/blob/grid_concurrency/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java |
…e (corrects issue #11881) (#12014) * Add logs * add more logs * Control the status of session request before timeout * Increase request session timeout by 5 seconds This allow the extended waiting to be done without being interrupted by timeoutSessions() method * remove logs LocalNewSessionQueue.java * remove logs * remove logger import * Add tests to check timeout behaviour * timeoutSessions method now checks if session is in queue before deleting it --------- Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
I encounter an issue when trying to execute more tests than a Selenium Grid can handle
My setup:
java -jar selenium-server-4.8.3.jar hub --session-request-timeout 30 --port 4448
java -jar selenium-server-4.8.3.jar node --max-sessions 1 --port 6666 --grid-url http://selenium-server.company.com:4448 --publish-events tcp://selenium-server.company.com:4442 --subscribe-events tcp://selenium-server.company.com:4443
The script adds a wait to force new sessions to be queued
So when starting the 4 instances (methods test1, test2, test3 and test4), I can see them run, or queued, but at some point, a session is created but not used: on the node, browser is started, but URL not loaded.
In that case, we need to wait 5 mins (default session timeout) for next test to be started
From what I observed, I would say that there is a race condition between the session request timeout and the session creation thread, as the "stalled" session is logged as timed out in test script logs:
Cannot create driver: Could not start a new session. Response code 500. Message: Could not start a new session. New session request timed out
Thanks for your help
How can we reproduce the issue?
Relevant log output
Moreover an other test showed the following events:
new RemoteWebDriver
The point here seems to be the delay between the slot reservation, when distributor receives the new session request and the session creation which is done after the timeout occured
Operating System
Hub: RHE 7.9, Node: Windows 10
Selenium version
4.7.2 (script), 4.8.3 (Hub & node)
What are the browser(s) and version(s) where you see this issue?
chrome 104
What are the browser driver(s) and version(s) where you see this issue?
chromedriver 104
Are you using Selenium Grid?
4.8.3
The text was updated successfully, but these errors were encountered: