TagHistoryManager().queryHistory : java.lang.IllegalArgumentException: Comparison method violates its general contract!

Ignition 8.1.0

I use TagHistoryManager().queryHistory to retrieve some history data from a module (gateway scope)

Sometimes, I have the following exception:

ResultWriter	03Dec2020 16:20:20	Error executing historical tag read.
java.lang.IllegalArgumentException: Comparison method violates its general contract!

what does it mean ?

            BasicTagHistoryQueryParams tagHistoryQueryParams = new BasicTagHistoryQueryParams();
            // /!\ Flag.and() doesn't mutate the object, it returns a new one
            Flags flags = Flags.of(TagHistoryQueryFlags.BOUNDING_VALUES_YES,
                    TagHistoryQueryFlags.NO_INTERPOLATION,
                    TagHistoryQueryFlags.NO_SCANCLASS_VALIDATION,
                    TagHistoryQueryFlags.NO_CACHE,
                    TagHistoryQueryFlags.NO_PREPROCESSED_DATA);

            tagHistoryQueryParams.setQueryFlags(flags);
            tagHistoryQueryParams.setReturnSize(-1);
            tagHistoryQueryParams.setAggregationMode(AggregationMode.LastValue);
            tagHistoryQueryParams.setStartDate(startDate);
            tagHistoryQueryParams.setEndDate(endDate);
            // Tall : Column format is fixed at "path, value, quality, timestamp".
            tagHistoryQueryParams.setReturnFormat(ReturnFormat.Tall);
            tagHistoryQueryParams.setPaths(paths);
            BasicStreamingDataset streamingDataset = new BasicStreamingDataset();
            logger.debug("queryHistoryDataChanges() - begin");

            this.gatewayContext.getTagHistoryManager().queryHistory(tagHistoryQueryParams, streamingDataset);
ResultWriter	03Dec2020 16:20:20	Error executing historical tag read.
java.lang.IllegalArgumentException: Comparison method violates its general contract!

at java.base/java.util.ComparableTimSort.mergeHi(Unknown Source)

at java.base/java.util.ComparableTimSort.mergeAt(Unknown Source)

at java.base/java.util.ComparableTimSort.mergeCollapse(Unknown Source)

at java.base/java.util.ComparableTimSort.sort(Unknown Source)

at java.base/java.util.Arrays.sort(Unknown Source)

at java.base/java.util.Arrays.sort(Unknown Source)

at java.base/java.util.ArrayList.sort(Unknown Source)

at java.base/java.util.Collections.sort(Unknown Source)

at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.runSpecialValueQuery(DatasourceQueryExecutor.java:864)

at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.readSeedValues(DatasourceQueryExecutor.java:699)

at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.primeRead(DatasourceQueryExecutor.java:885)

at com.inductiveautomation.ignition.gateway.sqltags.history.query.AbstractHistoryLoader.startReading(AbstractHistoryLoader.java:118)

at com.inductiveautomation.ignition.gateway.sqltags.history.query.AggregateHistoryQueryExecutor.startReading(AggregateHistoryQueryExecutor.java:85)

at com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryWriter.readData(HistoryWriter.java:312)

at com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryWriter.execute(HistoryWriter.java:230)

at com.inductiveautomation.ignition.gateway.sqltags.history.TagHistoryManagerImpl.queryHistory(TagHistoryManagerImpl.java:538)

at com.bouyguesenergiesservices.ignition.gateway.replay.tag.QueryHistoryTall.queryHistoryDataChanges(QueryHistoryTall.java:1108)

at com.bouyguesenergiesservices.ignition.gateway.replay.tag.QueryHistoryTall.queryHistory(QueryHistoryTall.java:886)

at com.bouyguesenergiesservices.ignition.gateway.replay.tag.QueryHistoryTall.lambda$queryHistoryAsync$0(QueryHistoryTall.java:170)

at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)

at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source)

at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)

at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)

at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)

at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)

I think this is a bug on our side. Not sure there’s anything you can do to fix it. I’ll make a ticket…

thanks, I stay tuned.

Did you find anything ?

The ticket has been designated to be picked up “next sprint”. I don’t have any more details about it.

1 Like

This is fixed in 8.1.2.

1 Like