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

The value of the tomcat.threads.config.max metric is always -1, irrespective of the configured maximum number of threads #40957

Closed
lass9436 opened this issue May 30, 2024 · 5 comments
Labels
type: regression A regression from a previous release
Milestone

Comments

@lass9436
Copy link

Bug

my application.yml is

application.yml

management:
  server:
    port: 8080
  endpoint:
    health:
      show-details: always
  endpoints:
    web:
      exposure:
        include: "*"
server:
  tomcat:
    threads:
      max: 400
      min-spare: 10
    mbeanregistry:
      enabled: true

but

http://localhost:8080/actuator/prometheus
1

I don't know why not working.

Environment

  • Spring Boot version: 3.3.0
  • JDK version: 17
  • OS: Windows 10

solution

my only solution is downgrading spring boot 3.3.0 to 3.2.6

Fortunately, it works successfully in 3.2.6, but I report this bug.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 30, 2024
@wilkinsona
Copy link
Member

wilkinsona commented May 30, 2024

Thanks for the report. The setting is working as expected and Tomcat's thread pool has a max size of 400. The problem is that the metric is incorrect.

I believe that the metric's incorrect due to #36087. It has changed the executor that Tomcat uses so it's no longer internal to the endpoint. This means that it returns -1 for its max threads:

    public int getMaxThreads() {
        if (internalExecutor) {
            return maxThreads;
        } else {
            return -1;
        }
    }

@wilkinsona wilkinsona changed the title Spring Boot 3.3.0 server.tomcat.threads.max Setting Not Functioning? Metrics related to Tomcat's thread pool have the wrong values May 30, 2024
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels May 30, 2024
@wilkinsona wilkinsona added this to the 3.3.x milestone May 30, 2024
@wilkinsona wilkinsona changed the title Metrics related to Tomcat's thread pool have the wrong values The value of the tomcat.threads.config.max metric is always -1, irrespective of the configured maximum number of threads May 30, 2024
@lass9436
Copy link
Author

Thank you for your kind reply. You actually said that Tomcat's maximum number of threads was set to 400, and the metric was incorrect.

3.3.0
2

But I debugged the part of code you mentioned, and maxThreads is 200. internalExecutor is false as you said. Is the value of 200 here meaningless?

3.2.6
326

It works normally in 3.2.6.

@wilkinsona
Copy link
Member

Yes, it's meaningless unless the executor is internal. What matters is the configuration of the endpoint's executor. If you look at this.executor in NioEndpoint, you should see it using the configured value for its maximum threads.

@mhalbritter
Copy link
Contributor

I've opened https://bz.apache.org/bugzilla/show_bug.cgi?id=69133 - if this is resolved, we can switch back to the default executor and set the queue size for #36087 via a normal setter.

@mhalbritter
Copy link
Contributor

Tomcat has added a setter to set the maximum queue size. When using this setter, this issue should go away. I've opened #41093 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

4 participants