-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Prevent browser to be created and unused in case a short session-request-timeout is set #12848
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
Conversation
I think there might be an easier way to handle this cases, just return a boolean in
The
Only a idea, i am not telling the current PR way is bad :D |
…selenium into driver_sessions_staled
I agree with you, there will be less changes in code |
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/remote/RemoteNewSessionQueue.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/SessionNotCreated.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR.
I am missing a test that also checks that the session is removed from the Node. You could add it in DistributorTest
.
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java
Outdated
Show resolved
Hide resolved
java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java
Outdated
Show resolved
Hide resolved
java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/SessionCreated.java
Outdated
Show resolved
Hide resolved
java/src/org/openqa/selenium/grid/sessionqueue/SessionNotCreated.java
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## trunk #12848 +/- ##
=======================================
Coverage 56.49% 56.49%
=======================================
Files 86 86
Lines 5255 5255
Branches 187 187
=======================================
Hits 2969 2969
Misses 2099 2099
Partials 187 187 ☔ View full report in Codecov by Sentry. |
@bhecquet Probably to verify the Distributor changes via tests, essentially to check if this works end to end as expected, have a look at the setup in https://github.com/SeleniumHQ/selenium/blob/trunk/java/test/org/openqa/selenium/grid/router/SessionQueueGridTest.java. The end-to-end tests there try to valid different scenarios involving the new session queue. Maybe add to the same test or create another test class with a similar setup to emulate the motivation the changes solve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @bhecquet!
…est-timeout is set (SeleniumHQ#12848) * Add logs * Prevent a session to be created while its timeout has expired * restore missing "remove" * Close timedout session on creation to prevent them to be staled * Correct stopping of expired sessions * Remove logs for final commit * removed a test that is now useless as request session timeout is now strict * Simplify session stopping if timeout expires * Add some tests * remove logs * Return value directly * remove unused method * Removed hard coded value * correct according to comments * Correct according to comments * Remove spaces * remove spaces * Remove unused import * Add comments to tell why session is valid * fix linter issues * Add a test when session time out * test improved * Running format script --------- Co-authored-by: titusfortner <titus.fortner@gmail.com> Co-authored-by: Diego Molina <diemol@users.noreply.github.com> Co-authored-by: Diego Molina <diemol@gmail.com>
Description
This PR corrects the issue #12832 where driver sessions may be created, but unused if driver takes long time to create
In out case, session request timeout is set to 30 secs, as we have several hubs for redundancy, and we do not want to be stuck with a single hub on driver creation.
Motivation and Context
When hubs are loaded, slots take some time to free, so that a new session can be created, and in this case, request session timeout may be raised during driver creation. As a result, driver is created on node, but client has received a SessionNotCreatedException
In this PR, after a driver is successfuly created, we check the session queue to see if the session request has expired or not. If it has expired (not in requests list or has reached timeout), then, we notify the node to stop the session immediately to release the slot
Types of changes
Checklist
I would have liked to add a unit test for LocalDistributor part, but could not find a proper way to do this. If you have any idea ...
Fixes #12832