--- Comment #2 from Christopher Schultz <> ---
Which version of tomcat-pool is in use?

I'll bet the problem is that the QueryStats are changing while the slow-query
report is running. is a call to Collections.sort() over an
ArrayList<QueryStats>. The sort uses a QueryStatsComparator object to sort, and
that comparator uses the "last invocation" of each query to provide the

If that "last invocation" changes during the sorting, weird things can happen.

My guess is that because Java 11 introduced the new TimSort which is a little
pickier about changing conditions during the sorting, you are seeing errors
which were previously simply ignored by the older merge-sort algorithm.

I'm not super-familiar with the operation of the SlowQueryReport. How often is
SlowQueryReport.removeOldest called? If it's "often", then this operation is
particularly heavy and probably ought to be optimized a bit.

I don't see an option to select the older merge-sort in the API, so the only
quick fix would be to NOT sort, which makes the current behavior (remove the
oldest N entries, where N may not = 1) difficult to reproduce.

Another quick fix (in terms of programming effort) would be to clone every
QueryStats object in the list before sorting it. Obviously, there would be a
performance hit for doing that.

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to