Skip to content

[ML] Model should defend against times earlier than epoch 0 #394

@droberts195

Description

@droberts195

I saw this in a Java test log:

[2019-02-13T11:42:03,268][WARN ][o.e.x.m.d.DatafeedManager] [node-2] [test-lookback-only-given-empty-index] Datafeed lookback retrieved no data
... SKIPPED 9 LINES ...
[2019-02-13T11:42:03,648][WARN ][o.e.t.OutboundHandler    ] [node-2] send message failed [channel: Netty4TcpChannel{localAddress=/127.0.0.1:34349, remoteAddress=/127.0.0.1:57094}]
java.lang.IllegalStateException: Negative longs unsupported, use writeLong or writeZLong for negative numbers [-3600000]
	at org.elasticsearch.common.io.stream.StreamOutput.writeVLong(StreamOutput.java:274) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSizeStats.writeTo(ModelSizeStats.java:156) ~[?:?]
	at org.elasticsearch.common.io.stream.StreamOutput.writeOptionalWriteable(StreamOutput.java:854) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction$Response$JobStats.writeTo(GetJobsStatsAction.java:277) ~[?:?]
	at org.elasticsearch.common.io.stream.StreamOutput.lambda$writeCollection$28(StreamOutput.java:1056) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.common.io.stream.StreamOutput.writeCollection(StreamOutput.java:1075) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.common.io.stream.StreamOutput.writeCollection(StreamOutput.java:1056) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.common.io.stream.StreamOutput.writeList(StreamOutput.java:1063) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]
	at org.elasticsearch.xpack.core.ml.action.util.QueryPage.writeTo(QueryPage.java:57) ~[?:?]
	at org.elasticsearch.action.support.tasks.TransportTasksAction$NodeTasksResponse.writeTo(TransportTasksAction.java:441) ~[elasticsearch-6.7.0-SNAPSHOT.jar:6.7.0-SNAPSHOT]

However, this did not actually fail any test.

It shows that a model size stats document contained an epoch time of -3600 seconds = -3600000 milliseconds. The Java side cannot cope with this. We should change the C++ code so that it does not create such documents.

A request to generate results for times before the epoch could fail the job, which would then cause a test failure on the Java side that we could fix.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions