Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃殌 Feature]: Killing Sessions via UI #11519

Open
shmikkil opened this issue Jan 6, 2023 · 20 comments
Open

[馃殌 Feature]: Killing Sessions via UI #11519

shmikkil opened this issue Jan 6, 2023 · 20 comments
Labels
C-grid help wanted Issues looking for contributions I-enhancement

Comments

@shmikkil
Copy link

shmikkil commented Jan 6, 2023

Feature and motivation

We are using k8s grid 4 and have the pods up and running all the time. It's a hassle to delete the pods that're stuck when sessions time out or when end-users doesn't close their sessions after the tests were executed. Any way we can add this feature to delete/remove sessions via the UI Console by right-clicking each of these sessions and remove them? Thank You!

Usage example

Right click on individual session IDs that are long running and delete/remove them.
2023-01-06 13_21_14-Selenium Grid

@github-actions
Copy link

github-actions bot commented Jan 6, 2023

@shmikkil, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jan 6, 2023

This could make sense. However, I would only enable that feature if the Grid is password protected or under a specific flag. Otherwise, anyone could delete any session and this might be annoying in shared Grids.

Please note that it is only possible to stop idle sessions, if a session is stuck in a request, the request needs to timeout before any action can be taken. You can always tune the session timeout to reduce this type of situation.

@diemol diemol added help wanted Issues looking for contributions and removed needs-triaging labels Jan 6, 2023
@github-actions
Copy link

github-actions bot commented Jan 6, 2023

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

@shmikkil
Copy link
Author

shmikkil commented Jan 6, 2023

This could make sense. However, I would only enable that feature if the Grid is password protected or under a specific flag. Otherwise, anyone could delete any session and this might be annoying in shared Grids.

Please note that it is only possible to stop idle sessions, if a session is stuck in a request, the request needs to timeout before any action can be taken. You can always tune the session timeout to reduce this type of situation.

Awesome...Glad to hear that! And yes, just going with a default pwd at the moment. Come to think of it, perhaps we should have another enhancement request where there should be an ability for the admins to assign creds to a specific group that could delete/maintain while the end-users who run the tests to be assigned to another group that simply can access the sessions during runtime to view the execution via the UI as well. Would that be helpful?

@diemol
Copy link
Member

diemol commented Jan 6, 2023

This could make sense. However, I would only enable that feature if the Grid is password protected or under a specific flag. Otherwise, anyone could delete any session and this might be annoying in shared Grids.
Please note that it is only possible to stop idle sessions, if a session is stuck in a request, the request needs to timeout before any action can be taken. You can always tune the session timeout to reduce this type of situation.

Awesome...Glad to hear that! And yes, just going with a default pwd at the moment. Come to think of it, perhaps we should have another enhancement request where there should be an ability for the admins to assign creds to a specific group that could delete/maintain while the end-users who run the tests to be assigned to another group that simply can access the sessions during runtime to view the execution via the UI as well. Would that be helpful?

I do not think Grid should start managing user profiles and passwords, that requires storage and managing those credentials very carefully. For now, Grid offers basic auth with a single user and password. That type of feature is out of scope.

@shmikkil
Copy link
Author

shmikkil commented Jan 6, 2023

This could make sense. However, I would only enable that feature if the Grid is password protected or under a specific flag. Otherwise, anyone could delete any session and this might be annoying in shared Grids.
Please note that it is only possible to stop idle sessions, if a session is stuck in a request, the request needs to timeout before any action can be taken. You can always tune the session timeout to reduce this type of situation.

Awesome...Glad to hear that! And yes, just going with a default pwd at the moment. Come to think of it, perhaps we should have another enhancement request where there should be an ability for the admins to assign creds to a specific group that could delete/maintain while the end-users who run the tests to be assigned to another group that simply can access the sessions during runtime to view the execution via the UI as well. Would that be helpful?

I do not think Grid should start managing user profiles and passwords, that requires storage and managing those credentials very carefully. For now, Grid offers basic auth with a single user and password. That type of feature is out of scope.

Thanks for the clarification!

@krmahadevan
Copy link
Contributor

@diemol - Basic question around this. If a session is stuck due to whatever reasons (for e.g., the client died/was killed) then wouldn't the session eventually timeout because the guava cache in LocalNode has a listener which seems to be triggering a delete session request for sessions that are about to be evicted.

  • If this cleanup logic is assumed to be reliable (things can still go wrong when we attempted to fire a POST request to delete session) then when would we need this sort of an explicit cleanup ?
  • Even if we were to provide that mechanism (by having the user call the delete session API) would that work because our cleanup would have cleaned up the slot to which this session was associated with ?

@diemol
Copy link
Member

diemol commented Jan 10, 2023

@krmahadevan yes, eventually the timeout will kick in and stop the session.

If this cleanup logic is assumed to be reliable (things can still go wrong when we attempted to fire a POST request to delete session) then when would we need this sort of an explicit cleanup ?

I see as the use case where a session was started with the wrong parameters and you do not want to wait until the timeout kicks in. An Appium session for example.

Even if we were to provide that mechanism (by having the user call the delete session API) would that work because our cleanup would have cleaned up the slot to which this session was associated with ?

The cleanup mechanism for timeout only kicks in when the timeout happens, so this new feature would just be a nice thing to have when one wants to stop the session.

@krmahadevan
Copy link
Contributor

I see as the use case where a session was started with the wrong parameters and you do not want to wait until the timeout kicks in. An Appium session for example.

Ok. In that case, it would just boil down to invoking the DELETE session api (endpoint: /se/grid/node/session/{sessionId}, operation: DELETE) via a curl right ?

@diemol
Copy link
Member

diemol commented Jan 10, 2023

I see as the use case where a session was started with the wrong parameters and you do not want to wait until the timeout kicks in. An Appium session for example.

Ok. In that case, it would just boil down to invoking the DELETE session api (endpoint: /se/grid/node/session/{sessionId}, operation: DELETE) via a curl right ?

That also works. However, the idea would be to have it as an option from the UI (under a flag or so).

@shmikkil
Copy link
Author

Any update on this enhancement request?

@diemol
Copy link
Member

diemol commented Feb 22, 2023

@shmikkil feel free to send a pull request to help us out! We are a group where most of the members are volunteers. If you need help to get started, please join our Slack channel https://www.selenium.dev/support/

@ksingha161
Copy link

until this is done is there a way to get all sessions related to a node uri ? Then we could just hit this api in a loop to delete all sessions @diemol
http://<node:uri>/se/grid/node/session/sessionId

@diemol
Copy link
Member

diemol commented May 12, 2023

You can send a DELETE to the Hub/Router. That is what driver.quit() does.

http://<hub:uri>/session/sessionId

@diemol
Copy link
Member

diemol commented May 12, 2023

Also, check the available endpoints here https://www.selenium.dev/documentation/grid/advanced_features/endpoints/

@karanjeetbirdeye
Copy link

Thanks, but for this sessionId is still needed. I'm just looking for a way to get all sessionId's.

@diemol
Copy link
Member

diemol commented May 12, 2023

Thanks, but for this sessionId is still needed. I'm just looking for a way to get all sessionId's.

Did you check what the status endpoint returns?

@karanjeetbirdeye
Copy link

Got it thanks, status endpoint contains the sessionId. Guess I can just parse it and pass it in the api. Thanks a lot.

@shah-shivam-410
Copy link

Hi @diemol , I tried something and want to test by building locally, since in standalone react server sessions wont be there.
Could you please share build guide resource, unable to find in repo.
I need to build react ui and grid and create standalone jar file.

@KrzysztofC

This comment was marked as off-topic.

@diemol diemol added the C-grid label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-grid help wanted Issues looking for contributions I-enhancement
Projects
None yet
Development

No branches or pull requests

7 participants