https://bz.apache.org/bugzilla/show_bug.cgi?id=64415

--- Comment #2 from Christopher Schultz <ch...@christopherschultz.net> ---
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.

SlowQueryReport.java:222 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
ordering.

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: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to