Nginx Timer is killing my request pool

tommy watson tommywatson+nginx-devel at gmail.com
Sat Feb 21 21:02:05 UTC 2015


Tigran,
  are you still using fork() ? As you describe here:
http://mailman.nginx.org/pipermail/nginx-devel/2015-February/006554.html

 If so, as already explained, the other process is probably closing your
request.

Cheers.


On Sat, Feb 21, 2015 at 2:55 PM, Tigran Bayburtsyan <
tigran.bayburtsyan at gmail.com> wrote:

> Hi All.
>
> 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  *ngx_palloc
> *because my r->pool is NULL.
> I can't find out why, here is my function
>
> *void add_aling_event(ngx_event_t *e, ngx_http_request_t *r, void
> (*handler), int timer)*
> *{*
> *    if(e)*
> *    {*
> *        ngx_add_timer(e, timer);*
> *        return;*
> *    }*
> *    ngx_event_t *event=ngx_palloc(r->pool,sizeof(ngx_event_t));*
> *    memset(event,0,sizeof(ngx_event_t));*
> *    event->data=r;*
> *    event->handler=handler;*
> *    event->log=r->connection->log;*
> *    ngx_add_timer(event, timer);*
> *}*
>
> And I'm calling this function like this.
>
> static ngx_int_t ngx_http_aling_handler(ngx_http_request_t *r)
> {
>     ........
>     ........
>     add_aling_event(NULL, r, hack_func, 50);
>     return NGX_AGAIN;
> }
>
> void hack_func(ngx_event_t *e)
> {
>     ngx_http_request_t *r = e->data;
>     ........
>     ........
>
>     switch(shmLen[1])
>     {
>         case 1: // adding chain
>         {
>             ..........................
> *            ..........................*
>         };break;
>         case 2: // adding last chain
>         {
>             ..........................
> *            ..........................*
>         };break;
>         default:
>         {
>             add_aling_event(e, r, hack_func, 50);
>         };break;
>     }
> }
>
> After 1 or 2 calls r->pool is sets to NULL .....
>
> Please help me figure out this issue.
> Maybe I'm doing something wrong.
> I've did this code using example here
> https://github.com/tommywatson/nginx-hello-world-module/blob/master/ngx_http_hello_world_module.c#L104
>
>
> Thanks.
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150221/9b907971/attachment.html>


More information about the nginx-devel mailing list