Skip to content

[🐞 Bug]: Socket connection is not getting closed in the hub node in Selenium grid 4.6.0 #11336

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

Closed
Codude opened this issue Nov 30, 2022 · 7 comments
Labels
B-grid Everything grid and server related C-java Java Bindings I-defect Something is not working as intended

Comments

@Codude
Copy link

Codude commented Nov 30, 2022

What happened?

Selenium grid : 4.6.0
OS : ubuntu 18.04 LTS

While we run more threads in parallel several drivers are created simultaneously. For a single automation run, we are getting many unclosed processes piled up on on JVM (PFA). This happens after we migrated from selenium 4.2.2 to 4.6.0

Screenshot 2022-11-30 at 11 09 12 AM

How can we reproduce the issue?

Run hub and node in selenium 4.6.0 and try to open as many drivers as you can and check the running process in JVM.

Relevant log output

java    12621 test  482u     IPv6            2995095       0t0      TCP <host1>:41134-><host2>:https (CLOSE_WAIT)
java    12621 test  483u     IPv6            2995123       0t0      TCP <host1>:41616-><host2>:https (CLOSE_WAIT)
java    12621 test  484u     IPv6            2995128       0t0      TCP <host1>:41626-><host2>:https (CLOSE_WAIT)
java    12621 test  485u     IPv6            3001717       0t0      TCP <host1>:42424-><host2>:https (CLOSE_WAIT)
java    12621 test  489u     IPv6            3001733       0t0      TCP <host1>:42456-><host2>:https (CLOSE_WAIT)

Operating System

Ubuntu 18.04

Selenium version

Java 4.6.0

What are the browser(s) and version(s) where you see this issue?

Chrome 106.0.5249.119

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 106.0.5249.61

Are you using Selenium Grid?

4.6.0

@Codude Codude added I-defect Something is not working as intended A-needs-triaging A Selenium member will evaluate this soon! labels Nov 30, 2022
@github-actions
Copy link

@Codude, 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!

@Codude
Copy link
Author

Codude commented Nov 30, 2022

Reverted back to selenium 4.2.2, I can still see those CLOSE_WAIT processes not closed for this version too. Only difference is amount of processes. grid 4.6.0 has more ( atleast 3 times ) processes in this state than grid 4.2.2.

@Codude Codude changed the title [🐛 Bug]: Socket connection is not getting closed in the hub node in Selenium grid 4.6.0 [🐞 Bug]: Socket connection is not getting closed in the hub node in Selenium grid 4.6.0 Nov 30, 2022
@diemol
Copy link
Member

diemol commented Nov 30, 2022

Seems to be the same as #11270, can you please double check?

@diemol diemol added C-java Java Bindings and removed A-needs-triaging A Selenium member will evaluate this soon! labels Nov 30, 2022
@Codude
Copy link
Author

Codude commented Dec 1, 2022

@Override
	public void quit() {
		//same as parent implementation, we just try to quit multiple times to make sure we close it incase of any runtime errors
		for(int i=0;i<5;i++) {
			try {
				super.quit();
				break;
			}
			catch(Exception e) {}
		}
System.gc();
	}

We override the quit() method and do this to ensure run time errors. We didn't use any sleep in here as mentioned in the previous bug. I've added the mentioned System.gc(); call after the loop but still we got those CLOSE_WAIT in grid 4.6.0

The same code I used in grid 4.2.2, there are no CLOSE_WAIT calls in the JVM process

@titusfortner titusfortner added the B-grid Everything grid and server related label Dec 1, 2022
@pujagani
Copy link
Contributor

pujagani commented Dec 2, 2022

If the concern is the socket connection not closing on quit, then the fix #11345 should ideally take care of it. We open websocket connection when initializing any driver that supports CDP, however, we were not closing the socket on driver.quit(). The fix for the same has been added. We are waiting to ensure all CI tests pass before merging it in.

@diemol
Copy link
Member

diemol commented Dec 5, 2022

PR #11345 has been merged, so this should be fixed. I will do a 4.7.1 release in 1-2 days and you can check this again.

@diemol diemol closed this as completed Dec 5, 2022
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B-grid Everything grid and server related C-java Java Bindings I-defect Something is not working as intended
Projects
None yet
Development

No branches or pull requests

4 participants