<div dir="ltr"><div>Tigran,<br></div><div>  are you still using fork() ? As you describe here: <a href="http://mailman.nginx.org/pipermail/nginx-devel/2015-February/006554.html">http://mailman.nginx.org/pipermail/nginx-devel/2015-February/006554.html</a></div><div><br></div><div> If so, as already explained, the other process is probably closing your request.</div><div><br></div><div>Cheers.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 21, 2015 at 2:55 PM, Tigran Bayburtsyan <span dir="ltr"><<a href="mailto:tigran.bayburtsyan@gmail.com" target="_blank">tigran.bayburtsyan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All.<div><br></div><div>I've created a function for adding my custom ngx_timer , but after 1st time loop my r->pool is setting to NULL , also it sets NULL my r->connection->log, and after second loop it throws exception on  <i>ngx_palloc </i>because my r->pool is NULL.</div><div>I can't find out why, here is my function</div><div><br></div><div><div><i>void add_aling_event(ngx_event_t *e, ngx_http_request_t *r, void (*handler), int timer)</i></div><div><i>{</i></div><div><i>    if(e)</i></div><div><i>    {</i></div><div><i>        ngx_add_timer(e, timer);</i></div><div><i>        return;</i></div><div><i>    }</i></div><div><i>    ngx_event_t *event=ngx_palloc(r->pool,sizeof(ngx_event_t));</i></div><div><i>    memset(event,0,sizeof(ngx_event_t));</i></div><div><i>    event->data=r;</i></div><div><i>    event->handler=handler;</i></div><div><i>    event->log=r->connection->log;</i></div><div><i>    ngx_add_timer(event, timer);</i></div><div><i>}</i></div></div><div><i><br></i></div><div>And I'm calling this function like this.</div><div><i><br></i></div><div><div style="font-style:italic">static ngx_int_t ngx_http_aling_handler(ngx_http_request_t *r)</div><div style="font-style:italic">{</div><div style="font-style:italic">    ........</div><div style="font-style:italic">    ........</div><div style="font-style:italic">    add_aling_event(NULL, r, hack_func, 50);</div><div style="font-style:italic">    return NGX_AGAIN;</div><div style="font-style:italic">}</div><div style="font-style:italic"><br></div><div style="font-style:italic"><div>void hack_func(ngx_event_t *e)</div><div>{</div><div>    ngx_http_request_t *r = e->data;</div><div>    ........</div><div>    ........</div><div>   </div><div>    switch(shmLen[1])</div><div>    {</div><div>        case 1: // adding chain</div><div>        {</div><div>            ..........................</div><div><i>            ..........................</i></div><div>        };break;</div><div>        case 2: // adding last chain</div><div>        {</div><div>            ..........................</div><div><i>            ..........................</i></div><div>        };break;</div><div>        default:</div><div>        {</div><div>            add_aling_event(e, r, hack_func, 50);</div><div>        };break;</div><div>    }</div><div>}</div></div><div style="font-style:italic"><br></div><div>After 1 or 2 calls r->pool is sets to NULL ..... </div></div><div><br></div><div>Please help me figure out this issue.</div><div>Maybe I'm doing something wrong.</div><div>I've did this code using example here <a href="https://github.com/tommywatson/nginx-hello-world-module/blob/master/ngx_http_hello_world_module.c#L104" style="font-size:12.8000001907349px" target="_blank">https://github.com/tommywatson/nginx-hello-world-module/blob/master/ngx_http_hello_world_module.c#L104</a> </div><div><br></div><div>Thanks.</div></div>
<br>_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br></blockquote></div><br></div>