You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Emond Papegaaij (JIRA)" <ji...@apache.org> on 2013/01/08 10:04:13 UTC
[jira] [Reopened] (WICKET-4955) SessionData violates comparison
contract
[ https://issues.apache.org/jira/browse/WICKET-4955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emond Papegaaij reopened WICKET-4955:
-------------------------------------
Assignee: Emond Papegaaij (was: Martin Grigorov)
I don't think your fix is correct. this error is about the requestlogger, not about the actions in BufferedWebResponse. Also, your fix on these actions is not a fix: Comparable's contract states you should return a negative number, 0 or a positive number. It does not matter if you return Integer.MIN_VALUE or -1. This problem is about violating other parts of the contract, such as sgn(x.compareTo(y)) == -sgn(y.compareTo(x)).
What probably happens is that during the sorting a request changes the lastActive value, changing the sort order during the sorting process.
The compareTo methods you changed in Action are also wrong:
Given 2 MetaDataActions a and b, a.compareTo(b) == -1 and b.compareTo(a) == -1, this is not allowed and will trigger this exception.
> SessionData violates comparison contract
> ----------------------------------------
>
> Key: WICKET-4955
> URL: https://issues.apache.org/jira/browse/WICKET-4955
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 6.4.0
> Environment: java 7
> Reporter: Sverre Boschman
> Assignee: Emond Papegaaij
> Priority: Minor
> Labels: requestlogger
> Fix For: 1.5.10, 6.5.0
>
>
> AbstractRequestLogger.getLiveSessions sorts the SessionData objects, this sort 'sometimes' (most likely load/concurrency) results in a contract violation:
> Caused by: org.apache.wicket.WicketRuntimeException: Error calling method: public final java.lang.Integer org.apache.wicket.proxy.$Proxy200.getLiveSessions() on object: org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler@438532d0
> at org.apache.wicket.core.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1148)
> at org.apache.wicket.core.util.lang.PropertyResolver$ObjectAndGetSetter.getValue(PropertyResolver.java:649)
> at org.apache.wicket.core.util.lang.PropertyResolver.getValue(PropertyResolver.java:103)
> at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:86)
> at org.apache.wicket.Component.getDefaultModelObject(Component.java:1615)
> ... 75 more
> Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
> at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:835)
> at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:453)
> at java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:392)
> at java.util.ComparableTimSort.sort(ComparableTimSort.java:191)
> at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
> at java.util.Arrays.sort(Arrays.java:472)
> at org.apache.wicket.protocol.http.AbstractRequestLogger.getLiveSessions(AbstractRequestLogger.java:135)
> at nl.topicus.cobra.monitoring.BaseApplicationInfo.getLiveSessions(BaseApplicationInfo.java:103)
> at sun.reflect.GeneratedMethodAccessor256.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:434)
> at org.apache.wicket.proxy.$Proxy200.getLiveSessions(Unknown Source)
> at sun.reflect.GeneratedMethodAccessor255.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.apache.wicket.core.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1144)
> ... 79 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira