Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Revert merge request #139 #579

merged 1 commit into from

1 participant


As well reported on the bug report #153, there was a side effect by applying this patch. This side effect was caused due to a race condition while cleaning and creating a new instance of the ModSecurity standalone implementation. Sometimes the second instance was freed instead of the first. Leaving the resource utilized by the first instance occupied, however, in a inconsistent way, leading ModSecurity to fail.

The first reported bug (#137) which this patch was made to fix, is not so critical in the sense that it does not leave the ModSecurity to fail straight. Having said that I am now reverting this fix, opening again the issue #137.

@zimmerle zimmerle merged commit 61e54f2 into SpiderLabs:remotes/trunk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 18, 2013
  1. @zimmerle

    Revert "Merge pull request #139 from chaizhenhua/remotes/trunk"

    zimmerle authored
    This reverts commit 10fd40f, reversing
    changes made to 414033a.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 13 deletions.
  1. +4 −13 nginx/modsecurity/ngx_http_modsecurity.c
17 nginx/modsecurity/ngx_http_modsecurity.c
@@ -61,7 +61,7 @@ static char *ngx_http_modsecurity_enable(ngx_conf_t *cf, ngx_command_t *cmd, voi
static ngx_http_modsecurity_ctx_t * ngx_http_modsecurity_create_ctx(ngx_http_request_t *r);
static int ngx_http_modsecurity_drop_action(request_rec *r);
-static void ngx_http_modsecurity_terminate(void *data);
+static void ngx_http_modsecurity_terminate(ngx_cycle_t *cycle);
static void ngx_http_modsecurity_cleanup(void *data);
static int ngx_http_modsecurity_save_headers_in_visitor(void *data, const char *key, const char *value);
@@ -115,8 +115,8 @@ ngx_module_t ngx_http_modsecurity = {
ngx_http_modsecurity_init_process, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
- NULL, /* exit process */
- NULL, /* exit master */
+ ngx_http_modsecurity_terminate, /* exit process */
+ ngx_http_modsecurity_terminate, /* exit master */
@@ -886,15 +886,6 @@ static server_rec *modsec_server = NULL;
static ngx_int_t
ngx_http_modsecurity_preconfiguration(ngx_conf_t *cf)
- ngx_pool_cleanup_t *cln;
- cln = ngx_pool_cleanup_add(cf->pool, 0);
- if (cln == NULL) {
- return NGX_ERROR;
- }
- cln->handler = ngx_http_modsecurity_terminate;
/* XXX: temporary hack, nginx uses pcre as well and hijacks these two */
pcre_malloc = modsec_pcre_malloc;
pcre_free = modsec_pcre_free;
@@ -922,7 +913,7 @@ ngx_http_modsecurity_preconfiguration(ngx_conf_t *cf)
static void
-ngx_http_modsecurity_terminate(void *data)
+ngx_http_modsecurity_terminate(ngx_cycle_t *cycle)
if (modsec_server) {
Something went wrong with that request. Please try again.