Skip to content

Read fuzzy hash db on init #1339

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

Closed
wants to merge 2 commits into from

Conversation

p0pr0ck5
Copy link
Contributor

@p0pr0ck5 p0pr0ck5 commented Mar 3, 2017

Instead of reading the fuzzy db on every invocation, read and store
the db contents during initialization and store the contents in memory.
The only significant behavior change here is that a change in db contents
now (obviously) requires a daemon restart, as no API is provided to
flush the list of ssdeep chunks.

Since we're re-opening this file with every invocation, let's
close our sanity check fd.
@p0pr0ck5
Copy link
Contributor Author

p0pr0ck5 commented Mar 3, 2017

This also obviates #1332, so we can nix that one if this is worthwhile.

Instead of reading the fuzzy db on every invocation, read and store
the db contents during initialization and store the contents in memory.
The only significant behavior change here is that a change in db contents
now (obviously) requires a daemon restart, as no API is provided to
flush the list of ssdeep chunks.
@p0pr0ck5
Copy link
Contributor Author

p0pr0ck5 commented Mar 7, 2017

(re-did this to insert elements to the tail of the list upon initialization, so that the file contents are processed top-down during execution, matching the existing behavior).

@meatlayer
Copy link

@p0pr0ck5 Hello.
I also encountered memory leaks when using fuzzy hash.
Issue #1288
Interested. You think your changes really can help to get rid of the leaks?

@p0pr0ck5
Copy link
Contributor Author

No, this PR is not about a memory leak. This just removes the need to re-read the fuzzy hash db from disk on every invocation. Your noted issue is unrelated to this PR.

@zimmerle zimmerle self-requested a review March 22, 2017 16:39
@zimmerle zimmerle self-assigned this Mar 22, 2017
@zimmerle zimmerle added the 2.x Related to ModSecurity version 2.x label Mar 22, 2017
zimmerle pushed a commit that referenced this pull request Apr 6, 2017
@zimmerle
Copy link
Contributor

zimmerle commented Apr 6, 2017

Pull request is currently under our buildbots - http://www.modsecurity.org/developers/buildbot/waterfall

@zimmerle
Copy link
Contributor

zimmerle commented Apr 6, 2017

Thanks @p0pr0ck5 -- merged ;)

@zimmerle zimmerle closed this Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to ModSecurity version 2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants