-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
[JENKINS-72016] Define a thread pool for ProxyConfiguration
’s HttpClient
#8490
Conversation
ProxyConfiguration
’s HttpClient
ProxyConfiguration
’s HttpClient
|
||
@Test | ||
public void httpClientExecutor() throws Exception { | ||
for (int i = 0; i < 50_000; i++) { |
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.
Takes <1m on my laptop, so I am hoping this is reasonable to keep as is. If not, it could be @Ignore
d or deleted.
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.
Looks reasonable and fixes the performance issue when using a lot of throw-away HttpClients
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.
Looks reasonable and fixes the performance issue when using a lot of throw-away HttpClients
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.
/label ready-for-merge
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.
Thanks!
(removed ready for merge, the new test is failing on windows) |
…Client` (jenkinsci#8490) * Define a thread pool for `ProxyConfiguration`’s `HttpClient` * Skip test on Windows jenkinsci#8490 (comment) (cherry picked from commit 3e1747e)
#7398 advertises a standardized
HttpClient
factory, and saysWhen this advice is followed in some CloudBees CI plugins, obtaining a fresh
HttpClient
per request, under some circumstances where many requests are made the result is a gigantic number of threads withHttpClient
in the name, eventually crashing the controller.See JENKINS-72016.
Testing done
Ran the new test with
watch 'jstack $(jps -lm | fgrep booter | awk "{print \$1}")|egrep \^\"|wc -l'
Prior to patch: the test slows down and finally hangs without making it to 9000 requests. There are in the vicinity of 18000 threads in the JVM at this point. Sometimes the JVM crashes with
OutOfMemoryError
claiming it cannot create a new native thread. (This is pre-Loom!)After patch: the test runs steadily to completion. The JVM thread count fluctuates around 4000 or so. A new
HttpClientImpl.SelectorManager
thread is created each time, but these seem to terminate themselves fairly soon rather than piling up indefinitely.Proposed changelog entries
Proposed upgrade guideliness
N/A
Before the changes are marked as
ready-for-merge
:Maintainer checklist