Welcome! Log In Create A New Profile

Advanced

missing module context

July 10, 2012 04:32AM
Hello Colleagues,
I am working on a project, that uses nginx as http proxy and I have
written many nginx modules. For several months till now I am looking for
a bug in one of my modules but I cannot find it. It appears very rare
but even so it should be fixed.

I added many log messages to debug the issue. I found that some time the
module context is null even it has been set before. I am using context
functions as usual:
1. In rewrite phase :
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_my_ctx_t));
ngx_http_set_ctx(r, ctx, ngx_http_my_module);

2. In log phase I am trying to get back my context :
ctx = ngx_http_get_module_ctx(r, ngx_http_my_module);
In this place ctx is NULL.

What is your opinion? Am am using this sequence on many places and it
works as I expected but in this modules sometimes it fails.
I think there could be a memory corruption issue. There could be a code
that may write on request's context array and overwrite the context
pointer. Is there a way to check this? Nginx uses its own memory pool
system and tools like valgrind is not longer usable.

Please advise me how to find this issue...

All ideas are welcome!
Best Regards

Anatoli Marinov




_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

missing module context

toli 1466 July 10, 2012 04:32AM

Re: missing module context

Valentin V. Bartenev 582 July 10, 2012 06:18AM

Re: missing module context

Valentin V. Bartenev 509 July 10, 2012 06:26AM

Re: missing module context

toli 634 July 10, 2012 07:54AM

Re: missing module context

Valentin V. Bartenev 560 July 11, 2012 12:10PM

Re: missing module context

toli 815 July 13, 2012 04:10AM



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

Online Users

Guests: 242
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