lift / lift/framework

Scheduler leaking thread pools

Open
#1,712 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

It seems that the interaction between LiftSession and Schedule is causing thread pools to leak at shutdown time. I've been seeing this at shutdown time with Tomcat; Schedule.shutdown seems to be called when the servlet is destroyed, but shutDownAllSessions for LiftSession is running asynchronously somewhere else. The way Schedule is implemented, it looks like its backing threadpool is re-created in this case, but then nothing is responsible for shutting it down again. In the best case, this causes the pool to be leaked, in the worst case, it prevents Tomcat (and probably other containers) from shutting down gracefully, since they're not daemon threads.

I brought this up on the mailing list, and it sounds like it is indeed a bug, though I'm skeptical that the proposed solution on the mailing list will be adequate (as I mentioned in that thread).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the shutdown lifecycle between Schedule.shutdown, LiftSession, and shutDownAllSessions, starting with the scheduler and session lifecycle code. Review the linked mailing-list discussion and reproduce shutdown under Tomcat if possible. Done means shutdown does not recreate or leave behind non-daemon thread pools and the container exits gracefully.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.