Welcome! Log In Create A New Profile

Advanced

Re: Nginx Timer is killing my request pool

February 22, 2015 03:24AM
Hi.
I can't find out why Nginx calling ngx_http_free_request function after
ngx_add_timer , if I'm not calling ngx_http_finalize_request
or something relevant ?
Should I do something to keep request in memory ?

Thanks.

2015-02-22 1:28 GMT+04:00 Tigran Bayburtsyan <tigran.bayburtsyan@gmail.com>:

> Ok I sow that code during debugging Nginx request , but why my request is
> freeing if I'm not calling ngx_http_finalize_request ?
> What should I do to keep my request alive ?
>
> Thanks.
>
> 2015-02-22 1:23 GMT+04:00 tommy watson <tommywatson+nginx-devel@gmail.com>
> :
>
>> My money is on your request has been cleaned up
>> in ngx_http_free_request():
>>
>>
>> https://github.com/nginx/nginx/blob/master/src/http/ngx_http_request.c#L3493
>>
>> On Sat, Feb 21, 2015 at 3:19 PM, Tigran Bayburtsyan <
>> tigran.bayburtsyan@gmail.com> wrote:
>>
>>> No this time I'm trying to do it with separate process by just sharing
>>> memory between Nginx worker and my 3rd party excusable...
>>> I'm making ngx_timer to send data when it will be received from shared
>>> memory.
>>>
>>> It works fine, but I can't figure out why my r->pool is null ?
>>>
>>> I'm using Nginx 1.7 version.
>>> Thanks for your help.
>>>
>>>
>>> 2015-02-22 1:02 GMT+04:00 tommy watson <
>>> tommywatson+nginx-devel@gmail.com>:
>>>
>>>> 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@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@nginx.org
>>>>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> nginx-devel mailing list
>>>> nginx-devel@nginx.org
>>>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> nginx-devel mailing list
>>> nginx-devel@nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>>
>>
>>
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>
>
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Nginx Timer is killing my request pool

tigran.bayburtsyan 731 February 21, 2015 03:56PM

Re: Nginx Timer is killing my request pool

tommy watson 327 February 21, 2015 04:04PM

Re: Nginx Timer is killing my request pool

tigran.bayburtsyan 435 February 21, 2015 04:22PM

Re: Nginx Timer is killing my request pool

tommy watson 382 February 21, 2015 04:26PM

Re: Nginx Timer is killing my request pool

tigran.bayburtsyan 451 February 21, 2015 04:30PM

Re: Nginx Timer is killing my request pool

tigran.bayburtsyan 486 February 22, 2015 03:24AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready