Bug 59890

Summary: Tomcat jdbc 7.0.68 : Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract! ( Similar to Bug 58489 : https://bz.apache.org/bugzilla/show_bug.cgi?id=58489)
Product: Tomcat Modules Reporter: Nishan <ns142e>
Component: jdbc-poolAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: kulbhushan.cusat
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: SunOS   

Description Nishan 2016-07-21 16:23:31 UTC
We are facing same exception in our env’s when we have upgraded our setup from: 

	From :
		Java : jdk1.6.0_45
		Java Apache Tomcat Version 7.0.37 
To 
		Java : jdk1.8.0_92
		Java Apache Tomcat Version 7.0.68


Sample SQL which during which this exception occurred :
SELECT DISTINCT c.comp_id AS dbkey
FROM
  equipment e,
  component c
WHERE
  e.equip_id = c.equip_id AND
((e.ptnii_equip_name = 'cl2oh406me3' AND c.beg_slot = 7) AND trunc(c.port/1000)-1 = '2') AND mod(c.port, 1000) = 0

JFYI : Result I see in TOAD by directly executing above SQL is only 1 record with value as :
		1166506

Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeLo(TimSort.java:777)
        at java.util.TimSort.mergeAt(TimSort.java:514)
        at java.util.TimSort.mergeCollapse(TimSort.java:439)
        at java.util.TimSort.sort(TimSort.java:245)
        at java.util.Arrays.sort(Arrays.java:1512)
        at java.util.ArrayList.sort(ArrayList.java:1454)
        at java.util.Collections.sort(Collections.java:175)
        at org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.removeOldest(SlowQueryReport.java:213)
        at org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.getQueryStats(SlowQueryReport.java:200)
        at org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportQuery(SlowQueryReport.java:110)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:256)
        at com.sun.proxy.$Proxy666.executeQuery(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor4273.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:235)
        at com.sun.proxy.$Proxy666.executeQuery(Unknown Source)
        at com.att.lpp.pa.core.asset.dao.AssetSearchDaoImpl.findAssetDbkeys(AssetSearchDaoImpl.java:116)
Comment 1 Felix Schumacher 2016-07-24 10:31:43 UTC

*** This bug has been marked as a duplicate of bug 58489 ***