1

Tomcat document provided configuration to handle stuck thread by enabling threshold and interruptThreadThreshold subsequently.

https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Stuck_Thread_Detection_Valve

I have enabled it in spring boot 2.x.x for embedded tomcat using bean based configuration and achieved it. It is able to kill thread if it is exceeding threshold.

I am looking for what is cons for enabling it. As of now i did not get any docs about best practices.

Any help would be appreciable.

Akkave
  • 303
  • 2
  • 4
  • 17

1 Answers1

2

You should really ask yourself why do you need to configure this setting. The main reason usually is to prevent resource exhaustion in a production environment. But this is a mitigation, not a solution. Every time a thread is killed it means some task has not been completed, and there is potential for data corruption. The best practice should be to analyze why a thread is taken too much time and fix it whenever possible.

aled
  • 21,330
  • 3
  • 27
  • 34