Skip to content

Continuous queries should guard against data loops #323

Closed
@pauldix

Description

@pauldix

It's possible to create a continuous query that causes a data loop and thus creation of infinite number of time series until the server crashes. It should guard against this.

For example, say you're writing things like stats.cpu and stats.memory. And then you issue a continuous query like this:

select from /stats\..*/ group by time(5m) into :series_name.5m

That will cause an infinite series loop. The first time it runs it'll output stats.cpu.5m and stats.memory.5m and then the next time it runs it'll output those and stats.cpu.5m.5m and stats.memory.5m.5m and on and on.

This should be guarded against in two places. First, before the continuous query gets created, it should issue a query, and check the resulting series names against the regex matcher. If it matches, it should not create the query and return an infinite data loop error.

The other possibility is that it passes the first test, but then they start writing data in that would cause this. So whenever a continuous query is run, it should check the resulting time series against the regex matcher to ensure it doesn't match. If it does, don't write the point and log an error in the log so the user knows.

Activity

added this to the 0.6.0 milestone on Mar 10, 2014
nichdiekuh

nichdiekuh commented on Mar 11, 2014

@nichdiekuh

👍

modified the milestones: 0.5.4, 0.6.0 on Mar 31, 2014
pauldix

pauldix commented on Mar 31, 2014

@pauldix
MemberAuthor

These would be a valid queries that don't have data loops:

select from /^stats\..*/ group by time(5m) into rollups.:series_name.5m
select from /.*stats$/ into group by time(5m) into :series_name.5m

You need to enforce a few things only if they have :series_name on the into clause.

  • that they have a ^ at the beginning OR they have a $ at the end
  • that the into doesn't start with :series_name OR it doesn't end with :series_name

I think that would be sufficient.

modified the milestones: 0.5.5, 0.5.4, 0.5.6, 0.5.7 on Apr 3, 2014
modified the milestones: 0.5.9, 0.5.7, 0.5.10 on Apr 17, 2014

8 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Continuous queries should guard against data loops · Issue #323 · influxdata/influxdb