[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2020-05-14 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Dave France  changed:

   What|Removed |Added

 CC||d.fra...@crossflight.com

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2020-05-13 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #13 from Christopher Schultz  ---
There is some good information (IMHO) in bug #64415 about this.

My method is essentially the same, except that I don't copy the whole
QueryStats object - only what is required to perform the evaluation.

I also protect against the data being updated during the copy/sort with an
additional check.

Let me know what you think.

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2020-05-13 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Christopher Schultz  changed:

   What|Removed |Added

 CC||spiffy2...@hotmail.com

--- Comment #12 from Christopher Schultz  ---
*** Bug 64415 has been marked as a duplicate of this bug. ***

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2020-05-12 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #11 from bill_t_w...@hotmail.com ---
I resolved this bug in SlowQueryReport,using the second proposal by Felix
Schumacher -- "extract the information to sort on from the QueryStats and sort
on that information".

1, add a constructor in the inner class QueryStats for QueryStats clone
/**
 * Create a new QueryStats object based on another QueryStats object.
 * For resolving Bug 58489,
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489
 * @param qs
 */
QueryStats(QueryStats qs){
this.query = qs.query;
this.nrOfInvocations = qs.nrOfInvocations;
this.maxInvocationTime = qs.maxInvocationTime;
this.maxInvocationDate = qs.maxInvocationDate;
this.minInvocationTime = qs.minInvocationTime;
this.minInvocationDate = qs.minInvocationDate;
this.totalInvocationTime = qs.totalInvocationTime;
this.failures = qs.failures;
this.prepareCount = qs.prepareCount;
this.prepareTime = qs.prepareTime;
this.lastInvocation = qs.lastInvocation;
}

2, modify method removeOldest
protected void removeOldest(ConcurrentHashMap queries) {
ArrayList list = new ArrayList<>(queries.values());
//For resolving Bug 58489,
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489
//make a list of cloned QueryStats objects
for(int i=0; i maxQueries) {
String sql = list.get(removeIndex).getQuery();
queries.remove(sql);
if (log.isDebugEnabled()) log.debug("Removing slow query, capacity
reached:"+sql);
removeIndex++;
}
}

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2020-05-12 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

bill_t_w...@hotmail.com changed:

   What|Removed |Added

 CC||bill_t_w...@hotmail.com

--- Comment #10 from bill_t_w...@hotmail.com ---
Created attachment 37237
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37237=edit
extract the information to sort on from the QueryStats and sort on that
information

I resolved this bug in SlowQueryReport,using the second proposal by Felix
Schumacher -- "extract the information to sort on from the QueryStats and sort
on that information".

1, add a constructor in the inner class QueryStats for QueryStats clone
/**
 * Create a new QueryStats object based on another QueryStats object.
 * For resolving Bug 58489,
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489
 * @param qs
 */
QueryStats(QueryStats qs){
this.query = qs.query;
this.nrOfInvocations = qs.nrOfInvocations;
this.maxInvocationTime = qs.maxInvocationTime;
this.maxInvocationDate = qs.maxInvocationDate;
this.minInvocationTime = qs.minInvocationTime;
this.minInvocationDate = qs.minInvocationDate;
this.totalInvocationTime = qs.totalInvocationTime;
this.failures = qs.failures;
this.prepareCount = qs.prepareCount;
this.prepareTime = qs.prepareTime;
this.lastInvocation = qs.lastInvocation;
}

2, modify method removeOldest
protected void removeOldest(ConcurrentHashMap queries) {
ArrayList list = new ArrayList<>(queries.values());
//For resolving Bug 58489,
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489
//make a list of cloned QueryStats objects
for(int i=0; i maxQueries) {
String sql = list.get(removeIndex).getQuery();
queries.remove(sql);
if (log.isDebugEnabled()) log.debug("Removing slow query, capacity
reached:"+sql);
removeIndex++;
}
}

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2019-04-23 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Craig Webb  changed:

   What|Removed |Added

 CC||c.w...@crossflight.com

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2017-08-07 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #9 from Michael Osipov <1983-01...@gmx.net> ---
We still suffer from this on Tomcat 8.5.x. I would go for option two as Felix
has proposed.

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2016-07-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Felix Schumacher  changed:

   What|Removed |Added

 CC||ns1...@att.com

--- Comment #8 from Felix Schumacher  ---
*** Bug 59890 has been marked as a duplicate of this bug. ***

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2016-07-24 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Felix Schumacher  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #7 from Felix Schumacher  ---
I believe this can happen, when the QueryStats change while the list of stats
get sorted.

I see three ways to go:
 1. add synchronization, so that the stats don't change while the list gets
sorted
 2. extract the information to sort on from the QueryStats and sort on that
information
 3. make QueryStats immutable and change the QueryStats instances, when the
stats gets updated

The first path probably will slow down the execution of jdbc calls.
The second one will be more memory intensive, but relatively simple to
implement. 
The third seems to be the one where we would have to do the most work.

I tend to go for option two. What do you think?

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2016-07-21 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #6 from Nishan  ---
Comment on attachment 34060
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34060
Tomcat-7.0.68 - Caused by: java.lang.IllegalArgumentException: Comparison
method violates its general contract!

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)

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2016-07-21 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #5 from Nishan  ---
Created attachment 34060
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34060=edit
Tomcat-7.0.68 - Caused by: java.lang.IllegalArgumentException: Comparison
method violates its general contract!

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2015-10-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #4 from Felix Schumacher  ---
I have ported the fix back to tomcat 7 as well. It will be in tomcat 7.0.66.

And again it would be nice, if you could test the current trunk of tomcat 7.

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2015-10-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #3 from Remy Tiitre  ---
I forgot to mention that it affects the Tomcat 7 as well. (Thats where I have
this issue right now). I think the bug was introduced with 7.0.63 release.

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2015-10-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Felix Schumacher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Felix Schumacher  ---
Thanks for the report.

Will be fixed with 8.0.29. Maybe you could give the trunk of tomcat 8 a try?

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2015-10-14 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

--- Comment #1 from Remy Tiitre  ---
SlowQueryReport.java line 478 is the reason for this crash. compare(x,x) should
not return 1.

if (stats1.lastInvocation == 0 && stats2.lastInvocation != 0) return 1;

-- 
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



[Bug 58489] QueryStatsComparator throws IllegalArgumentException: Comparison method violates its general contract!

2015-10-08 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=58489

Jan Havel  changed:

   What|Removed |Added

 CC||have...@gmail.com

-- 
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