Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous queries should guard against data loops #323

Closed
pauldix opened this issue Mar 10, 2014 · 2 comments
Closed

Continuous queries should guard against data loops #323

pauldix opened this issue Mar 10, 2014 · 2 comments
Assignees
Milestone

Comments

@pauldix
Copy link
Member

pauldix commented Mar 10, 2014

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.

@pauldix pauldix added this to the 0.6.0 milestone Mar 10, 2014
@nichdiekuh
Copy link

👍

@pauldix pauldix modified the milestones: 0.5.4, 0.6.0 Mar 31, 2014
@pauldix
Copy link
Member Author

pauldix commented Mar 31, 2014

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.

@jvshahid jvshahid modified the milestones: 0.5.5, 0.5.4, 0.5.6, 0.5.7 Apr 3, 2014
@pauldix pauldix modified the milestones: 0.5.9, 0.5.7, 0.5.10, 0.5.11 Apr 17, 2014
jvshahid added a commit that referenced this issue Apr 25, 2014
…ld-guard-against-data-loops

Fix #323. Continuous queries should guard against data loops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants