[Building Sakai] Java 7 and Sakai comparators

Neal Caidin nealcaidin at sakaifoundation.org
Wed Jun 19 07:04:06 PDT 2013


Hi David,

Thanks for this important information.
--------------------------------------------------------
Hi Dev list,

I've updated the release documentation at
https://confluence.sakaiproject.org/pages/viewpage.action?pageId=75106893

Was that the right thing to do?

Thanks,
Neal Caidin
Sakai CLE Community Coordinator


On Tue, Jun 18, 2013 at 3:54 PM, Hall, David (dmh2w) <
dmh2w at eservices.virginia.edu> wrote:

>  We recently upgraded our production Sakai instance to Sakai 2.9 at the
> University of Virginia, and as part of our upgrade, switched to Tomcat 7
> and Java 7. We were using Java 6 with our previous Sakai installation
> (2.8). Shortly after going live with 2.9, we began to receive isolated
> reports of users being unable to access the Resources tool in their
> worksites. This bug occurred with some worksites, but not others. The
> relevant portion of the stack trace was:****
>
> ** **
>
> caused by: java.lang.IllegalArgumentException: Comparison method violates
> its general contract!
>     at java.util.TimSort.mergeHi(TimSort.java:868)
>     at java.util.TimSort.mergeAt(TimSort.java:485)
>     at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
>     at java.util.TimSort.sort(TimSort.java:223)
>     at java.util.TimSort.sort(TimSort.java:173)
>     at java.util.Arrays.sort(Arrays.java:659)
>     at java.util.Collections.sort(Collections.java:217)
>     at
> org.sakaiproject.content.tool.ListItem.getListItem(ListItem.java:275)
>     at
> org.sakaiproject.content.tool.ResourcesAction.buildListContext(ResourcesAction.java:4314)
>     at
> org.sakaiproject.content.tool.ResourcesAction.buildMainPanelContext(ResourcesAction.java:4625)
> ****
>
> ** **
>
> We discovered that Java 7 implemented a new sort routine that strictly
> validates comparators. While Java 6 silently ignored issues with
> comparators not honoring transitivity etc, Java 7 throws an exception. Some
> of the custom comparators defined in Sakai code do not adhere strictly to
> spec, and this was the cause of the Resources failure. We’ve opened
> https://jira.sakaiproject.org/browse/KNL-1083 to track this issue. The
> overall fix will probably be to go through each custom comparator in Sakai
> and ensure it is well-behaved by Java 7 standards. It’s worth noting that
> https://jira.sakaiproject.org/browse/MSGCNTR-810 describes the same error
> within the Message Center tool (and fixes the particular comparator at
> issue).****
>
> ** **
>
> There is a property that can be set to force Java 7 to use the legacy sort
> routine from Java 6. As a workaround for this issue in the short term,
> we've set the JVM property ****
>
> ** **
>
> -Djava.util.Arrays.useLegacyMergeSort=true****
>
> ** **
>
> and this solved our issues. The new Java 7 sort routine was supposed to
> offer some performance improvements, but we’ve found the legacy sort to
> work fine for us in production. Just wanted to make anyone who may be using
> Java 7 with Sakai aware of this issue.****
>
> ** **
>
> Thanks,****
>
> Matthew****
>
> University of Virginia ****
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>



-- 
Neal Caidin
Sakai CLE Community Coordinator
nealcaidin at sakaifoundation.org
skype: nealkdin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130619/2344d6da/attachment.html 


More information about the sakai-dev mailing list