Skip to main content

IllegalArgumentException in Simulations

At times, users have reported of runtime exceptions while running a simulation that uses PRoPHET. The error signature looks like the following.

Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(Unknown Source)
at java.util.TimSort.mergeAt(Unknown Source)
at java.util.TimSort.mergeCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.ArrayList.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)

It may be noted that the default sorting algorithm has changed since Java 7 — rather than Merge sort, Tim sort is now used by default. However, it seems like it is possible to override the default sorting algorithm in Java using the following argument to the JVM.

-Djava.util.Arrays.useLegacyMergeSort=true

The execution command in the one.sh (or one.bat) file should be updated with the above argument to something like this:

java -Xmx512M -Djava.util.Arrays.useLegacyMergeSort=true -cp .:lib/ECLA.jar:lib/DTNConsoleConnection.jar core.DTNSim $*

I, however, do not have a Java 7 installation, and therefore, could not test it. Users facing the aforementioned runtime exception can try it out and share their experiences here.

Comments

  1. I just tried it, it works indeed, Thanks a lot ��

    ReplyDelete
    Replies
    1. Do you tell please...how to update this argument in one.bat file.....??? I've the same problem....

      Delete
    2. try
      "java -Djava.util.Arrays.useLegacyMergeSort=true -Xmx512M -cp .;lib/ECLA.jar;lib/DTNConsoleConnection.jar core.DTNSim %*" That works for me.

      Delete
    3. And I recommend that you should downgrade to a version earlier than Java 6 and try it.
      As an aside, if you are simulating using Eclipse, it will be solved by setting "Execution environment" value to Java6 or earlier one from the property of JRE system library in the project think.

      Delete
  2. I have tested it in latest version of java like shown below and it works

    java -Xmx512M -Djava.util.Arrays.useLegacyMergeSort=true -cp .;lib/DTNConsoleConnection.jar core.DTNSim %*


    Thanks a lot sir for the tutorial

    ReplyDelete

Post a Comment

Popular posts from this blog

Text Highlighting in Latex

While preparing a manuscript with Latex, it is often useful to highlight the changes made in the current revision with a different color. This can be achieved using the \ textcolor command provided by Latex. For example, \textcolor {red}{Hello World} would display the string "Hello World" in red color. However, the final/published copy of the manuscript does not contain any highlighted text. Therefore, if a large volume of changes were made, it becomes tiresome at the end to find and remove all the individual portions of highlighted text. This can be circumvented by defining a utility command to switch highlighting on and off as desired. In the following, we define a new Latex command, highlighttext , for this purpose. The command takes only a single argument—the text to be highlighted.     \usepackage {color}    % For highlighting changes in this version with red color   \newcommand { \highlighttext }[1] { \textcolor {red}{#1}}   % Remove...

Cohere Aya Dataset: Exploring the Split-by-language Collection

A snapshot of the Aya collection (Bengali) . Image taken from HuggingFace. In February 2024, Cohere launched Aya , a multilingual Large Language Model (LLM). Alongside, a set of datasets used to train Aya has also been released. For example, the aya_dataset consists around 205K examples annotated by humans. On the other hand, the recently released aya_collection_language_split is a gigantic dataset with more than 500 million data points spread across more than 100 languages. As the name suggests, this dataset is split by language. For example, all data points in Bengali, irrespective of the underlying task, can be found in a single split. Apart from the original human-annotated examples from the aya_dataset, aya_collection_language_split also contains a lot of translated and templated data. The dataset is released using an Apache-2.0 license, allowing academic and commercial use. The Bengali Language Split Each language split in the Aya collection has three splits. The Bengali split,...

Specifying Source and Destination of Messages

One of the frequently asked questions in the community is how to specify which particular nodes would act as source(s) and destination(s) of the messages created in the ONE simulator. The simulator, in fact, provides a pair of settings (shown below in bold face) aimed for this particular purpose. Let us consider that there are $n + 1$ nodes in an OMN.  Further, let the nodes with addresses from $x$ to $y$, both inclusive, would create messages. The nodes in the range $w$ to $z$, both inclusive, would be the destinations of those messages, where $0 \le x \le y \le n$, and $0 \le w \le z \le n$. Then, the corresponding simulation scenario can be configured as follows. ## Message creation parameters # How many event generators Events.nrof = 1 # Class of the first event generator Events1.class = MessageEventGenerator # (Following settings are specific for the MessageEventGenerator class) # Creation interval in seconds (one new message every 25 to 35 seconds) Events1.interval ...