Skip to content
Ameen Abozaid
Planned lessonMID-017-L04

Timeouts and leak detection

  • Lesson 4 of 5
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

configure timeouts that fail fast, and find leaks.

Planned topics

  • connectionTimeout: how long a thread waits for a connection (a few seconds, not 30 s default for APIs; verify default).
  • Database side: statement_timeout, lock_timeout, idle_in_transaction_session_timeout.
  • A leak is a borrowed connection never returned; leakDetectionThreshold logs a stack trace when one is held too long.
  • Pool exhaustion signs: threads blocked in HikariPool.getConnection in thread dumps, pending threads metric above zero.
  • Do not hold a connection across remote calls; spring.jpa.open-in-view can hold one for a whole request (consider turning it off).
Draft outline details

Demonstration

a thread dump excerpt with many threads waiting in HikariPool.getConnection.

Check your understanding

What does leakDetectionThreshold report?

Show answer

A stack trace for connections held longer than the threshold.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.