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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Java 11 #12843

Merged
merged 13 commits into from
Oct 6, 2023
Merged

Require Java 11 #12843

merged 13 commits into from
Oct 6, 2023

Conversation

titusfortner
Copy link
Member

I'm sure there's a lot more that can be cleaned up that I'm missing, but I think this is the first step.

Description

  • Requires Java 11
  • Removes Netty Http client
  • Defaults to Native Java

Motivation and Context

Fixes #11526

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b9bdff1) 56.51% compared to head (ac44568) 56.51%.
Report is 2 commits behind head on trunk.

❗ Current head ac44568 differs from pull request most recent head 44273c7. Consider uploading reports for the commit 44273c7 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #12843   +/-   ##
=======================================
  Coverage   56.51%   56.51%           
=======================================
  Files          86       86           
  Lines        5255     5255           
  Branches      187      187           
=======================================
  Hits         2970     2970           
  Misses       2098     2098           
  Partials      187      187           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joerg1985
Copy link
Member

This test is using the NettyClient directly, this should be fixed:

client = new NettyClient.Factory().createClient(config);

Does it make sense to have a bazel file in the jdk folder or could this just be part of the parent "../remote/http"?

@titusfortner
Copy link
Member Author

Does it make sense to have a bazel file in the jdk folder

I don't know? I mostly copied what I saw Netty had done in the places that seemed to make sense. If you think we should change something, we probably should because I don't really know what I'm changing. 😆

@joerg1985
Copy link
Member

Does it make sense to have a bazel file in the jdk folder

I don't know? I mostly copied what I saw Netty had done in the places that seemed to make sense. If you think we should change something, we probably should because I don't really know what I'm changing. 😆

I am no bazel expert too, there might be a reason for it :D

@joerg1985
Copy link
Member

I did some changes to make the bazel build work, i hope this is okay for you

@shs96c
Copy link
Member

shs96c commented Oct 1, 2023

Does it make sense to have a bazel file in the jdk folder or could this just be part of the parent "../remote/http"?

The "bazel way" is a build file per java package, so the jdk folder should definitely have its own BUILD.bazel file.

@shs96c
Copy link
Member

shs96c commented Oct 1, 2023

The NettyDomainSocketClient needs to stay, as it's used for the Docker integration because the other HttpClient implementations can't use unix domain sockets.

@joerg1985
Copy link
Member

I had to remove the htmlunit-driver dependency to get rid of the asynchttpclient, this added a circular dependency what should be avoided. Beside some helper classes i could not find any use of the htmlunit-driver so i hope this is fine. Lets wait what the CI will tell us.

@titusfortner
Copy link
Member Author

titusfortner commented Oct 1, 2023

the other HttpClient implementations can't use unix domain sockets

Looks like we can transition those things when we require Java 17 next year: https://openjdk.org/jeps/380

@titusfortner
Copy link
Member Author

@rbri is htmlunit-driver also moving to Java 11 requirement for the net release? Will that address the circular dependencies?

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need to make so many changes in a PR for this. We have always mentioned that moving completely to Java 11 is an iteration process.

Why don't we change the default http client, target Java 11 and that's it. The rest can be iterated little by little.

Long PRs are just too hard to review.

@joerg1985
Copy link
Member

@rbri is htmlunit-driver also moving to Java 11 requirement for the net release? Will that address the circular dependencies?

The circular dependency is now gone due to removal of the htmlunit-driver dependency.

@joerg1985
Copy link
Member

@diemol you are right about large PRs, but i think this PR is now ready. The CI is failing but this would also happen if only the default client has been changed. There is only one additional change here, the removal of the old netty client and it's dependencies (by removing the htmlunit-driver support).

@diemol
Copy link
Member

diemol commented Oct 1, 2023

However, almost all CI workflows in Java are failing. We cannot merge like that.

@titusfortner
Copy link
Member Author

Yeah, I didn't want to keep distributing a library with a vulnerability, which is why I removed the netty client instead of just changing the default.

Thanks @joerg1985 for doing all the work to clean up after me. 😁

I'll take a look at the failures tomorrow

@joerg1985
Copy link
Member

Okay then there should be single PRs created for all of the changes.

@pujagani
Copy link
Contributor

pujagani commented Oct 4, 2023

This also impacts the changes done as part of #11606. Hence the failing "DevToolsReuseTest" test. Earlier, this was not a problem since we used one instance of AsyncHttpClient and it was only closed when the JVM shuts down. With the JdkHttpClient, we use a new instance as required and close it too. Changes in #11345, which assigns the client to null is while closing causing the test failure and preventing re-use. It was done to prevent memory leaks. I am not sure about the right approach to address it. We might need to discuss/brainstorm over it.

@diemol
Copy link
Member

diemol commented Oct 4, 2023

This also impacts the changes done as part of #11606. Hence the failing "DevToolsReuseTest" test. Earlier, this was not a problem since we used one instance of AsyncHttpClient and it was only closed when the JVM shuts down. With the JdkHttpClient, we use a new instance as required and close it too. Changes in #11345, which assigns the client to null is while closing causing the test failure and preventing re-use. It was done to prevent memory leaks. I am not sure about the right approach to address it. We might need to discuss/brainstorm over it.

@pujagani is there a bug report for that? I can imagine that someone might bump into that situation when using the Java 11 client.

@titusfortner
Copy link
Member Author

Ok, the NettyDomainSocketTest calls NettyClient.Factory() which pretty much needs all of Netty plus AsyncHttpClient.

So I think we need a different test if we need a test for it.

@pujagani
Copy link
Contributor

pujagani commented Oct 5, 2023

@diemol I don't think there is one. Will double check else I will create it and link it here.

@titusfortner
Copy link
Member Author

titusfortner commented Oct 6, 2023

This is passing all the tests and looks right to me.

The only issue is that I removed NettyDomainSocketTest because it required AHC. If we need a test for that class, can someone please help add it?

@pujagani
Copy link
Contributor

pujagani commented Oct 6, 2023

#12882 - Created an issue to track the regression

@pujagani
Copy link
Contributor

pujagani commented Oct 6, 2023

This is passing all the tests and looks right to me.

The only issue is that I removed NettyDomainSocketTest because it required AHC. If we need a test for that class, can someone please help add it?

I looked into it, but I don't think the current test can be modified without having another client library. Since Java HTTP Client does not support UNIX sockets.

@rbri
Copy link
Contributor

rbri commented Oct 6, 2023

@rbri is htmlunit-driver also moving to Java 11 requirement for the net release? Will that address the circular dependencies?

The circular dependency is now gone due to removal of the htmlunit-driver dependency.

@joerg1985
first of all thanks for removing the outdated stuff. I think getting rid of the circular dependency is a step forward for selenium (see my comment on #12849).

Regarding the htmlunit-driver i think i have no chance - i have to move to Java 11. I like to stay with the support of the latest selenium version.
For HtmlUnit itself i like to stay at java8 if possible but i will see.
From my point of view we can go ahead with this making a compatible htmlunit-driver is a task on my desk like all the other htmlunit related stuff (of course any help is welcome....)

@titusfortner
Copy link
Member Author

Since Java HTTP Client does not support UNIX sockets.

But we're testing with java 17 and I think Java 17 does support it? Can we create an implementation in test code only?

@titusfortner titusfortner merged commit 9b35af2 into trunk Oct 6, 2023
48 of 54 checks passed
@titusfortner titusfortner deleted the java_11 branch October 6, 2023 14:14
@pujagani
Copy link
Contributor

pujagani commented Oct 9, 2023

Since Java HTTP Client does not support UNIX sockets.

But we're testing with java 17 and I think Java 17 does support it? Can we create an implementation in test code only?

Ahh yes! I think that can be done. I am not sure how can we create an implementation in test code only but will be happy to take a took.

aguspe pushed a commit to aguspe/selenium that referenced this pull request Oct 22, 2023
* [java] require Java 11

* [java] remove netty http client and use native java client by default

* [java] updated the list of exports

* [java] use the default http client in tests

* [java] removed --remote-allow-origins=* for the netty client

* [java] removed the asynchttpclient and htmlunit-driver dependencies

---------

Co-authored-by: Jörg Sautter <joerg.sautter@gmx.net>
kool79 added a commit to kool79/selenium that referenced this pull request Jun 13, 2024
…iumHQ#12843)

Workaround was made as part of the fix (3f7f57c) the bug SeleniumHQ#11750 which was specific for netty client only.
Since SeleniumHQ#12843 the netty client was removed.
diemol added a commit that referenced this pull request Jul 11, 2024
… (#14134)

* [java] Revert workaround for old netty http client (addendum to #12843)

Workaround was made as part of the fix (3f7f57c) the bug #11750 which was specific for netty client only.
Since #12843 the netty client was removed.

* Running format script

---------

Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
Co-authored-by: Diego Molina <diemol@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🚀 Feature]: Java 11 as the minimum supported version for Selenium Java bindings
7 participants